When we enable spell checker in CQ5, the default synonym provider class is com.day.crx.core.query.wordnet.WordNetSynonyms which is used to perform the spell check.
WordNet uses semantic algorithms to match synonyms. The service that CQ5 is using (WordNet Search - 3.1) works with the Perl implementation of it.
Another way could be,
the spell checker can be configured by using our own properties file as mentioned below
<param name="synonymProviderClass" value="org.apache.jackrabbit.core.query.lucene.PropertiesSynonymProvider"/>
<param name="synonymProviderConfigPath" value="synonyms.properties"/>
Some cases enabling the WordNet synonym providerdo not always meet the spell check need.
Doing semantic analysis programmatically will always create some false positives. If we can live with them we could use WordNet. Otherwise we could look for a different approach based on babelnet.org or just static files.
If we want to implement an additional provider besides the existing one we would need to use a wrapper class for this.