hunspell / hunspell

The most popular spellchecking library.

Home Page:http://hunspell.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

REP: support suggesting a lowercase replacement for an all-caps input

Gallaecio opened this issue · comments

Imagine a language where “bar” is a good word, and ”FOO“ is a common misspelling:

dic:

1
bar

aff

REP 1
REP ^FOO$ bar

At the moment, this suggestion does not work as I would expect. “bar” is not suggested for “FOO”. Nothing is suggested for “FOO”, in fact.

The best workaround I could find was using “foo” in the REP rule, but then the suggestion you get for “FOO” is “BAR”, not “bar”.

In an actual language, this may be relatively common when an acronym needs to be replaced with a regular word (e.g. SOS → help signal). I found this when trying to suggest “identificador único universal” as a replacement for “UUID” in Galician.

You can write your dic file as:

1
bar ph:FOO

If you type FOO then bar will be suggested on right click.

That is good to know, but that would not work for multi-word replacements, i.e. you cannot do:

1
identificador único universal ph:UUID

Replace space with underscore.

REP 2	
REP SOS help_signal
REP UUID identificador_único_universal

Make sure that all 5 words are part of dictionary. (help signal identificador único universal)

That’s what I tried and did not work (there was no suggestion for UUID), although I did use ^ and $ as seen in my original report.

I guess REP tag does not support ^ and $
Did you try without that as shown in my example?