Skip to content

Commit

Permalink
Add a analysis predicate so that informal or out of TDK dictionary wo…
Browse files Browse the repository at this point in the history
…rds are not allowed. This is a temporary fix for #12
  • Loading branch information
ahmetaa committed Nov 5, 2018
1 parent a512d18 commit e230e89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Binary file modified libreoffice-tr-tools/lib/runtime/zemberek-lo.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.List;
import zemberek.core.turkish.RootAttribute;
import zemberek.morphology.TurkishMorphology;
import zemberek.normalization.TurkishSpellChecker;

Expand All @@ -16,6 +17,10 @@ private ZemberekSpellCheck() {
this.morphology = TurkishMorphology.createWithDefaults();
try {
this.spellChecker = new TurkishSpellChecker(morphology);
// add a predicate to the spell checker
// so that informal or out of official Turkish dictionary words are not allowed.
this.spellChecker.setAnalysisPredicate(
a -> !a.getDictionaryItem().hasAnyAttribute(RootAttribute.Ext, RootAttribute.Informal));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit e230e89

Please sign in to comment.