Created attachment 191134 [details] Patch to add Thai Autocorrect data I would like to add Autocorrect data for Thai in which common misspelled words are corrected. As Thai script has no word delimiter, the matching patterns will be with both left and right wildcards so that words are matched at any position in a text chunk and fixed. For example, ".*กงศุล.*" -> "กงสุล" will fix a text chunk "สถานกงศุลใหญ่" to "สถานกงสุลใหญ่". This, however, may require additional adjustment to the current matching behavior to make it more complete. The current implementation stops immediately when the first pattern is matched. This means only one replacement will take place even though there can be more than one typos in the text chunk. For example, suppose there are only 2 rules in the Autocorrect rule set: - ".*กงศุล.*" -> "กงสุล" - ".*อนุญาติ.*" -> "อนุญาต" and the input text chunk is composed of 2 typos: "ขออนุญาติจากสถานกงศุลใหญ่". Assuming that the rules are matched in order, only the first rule will be matched in current implementation, and the text chunk becomes: "ขออนุญาติจากสถานกงสุลใหญ่" although the desired result is: "ขออนุญาตจากสถานกงสุลใหญ่" where both typos are fixed. So, I'm proposing 2 patches, one for the data, and the other for the code.
Created attachment 191135 [details] Patch to make Autocorrect match more than one rule
Gerrit commits to be reviewed: - Add Thai AutoCorrect data https://gerrit.libreoffice.org/c/core/+/160159 - SvxAutoCorrDoc::ChgAutoCorrWord() implementations: correct multiple patterns https://gerrit.libreoffice.org/c/core/+/160160
Hello Jonathan, I thought you may have better insight on this issue, and possibly review the submitted patch.