This tool is a spelling checker for Modern Turkish. It detects spelling errors and corrects them appropriately, through its list of misspellings and matching to the Turkish dictionary.
Install the latest version of Git.
In order to work on code, create a fork from GitHub page. Use Git for cloning the code to your local or below line for Ubuntu:
git clone <your-fork-git-link>
A directory called TurkishSpellChecker-Swift will be created. Or you can use below link for exploring the code:
git clone https://github.com/starlangsoftware/TurkishSpellChecker-Swift.git
To import projects from Git with version control:
XCode IDE, select Clone an Existing Project.
In the Import window, paste github URL.
Result: The imported project is listed in the Project Explorer view and files are loaded.
After being done with the downloading and opening project, select Build option from Product menu. After compilation process, user can run TurkishSpellChecker-Swift.
SpellChecker finds spelling errors and corrects them in Turkish. There are two types of spell checker available:
To instantiate this, a
FsmMorphologicalAnalyzer is needed.
let fsm = FsmMorphologicalAnalyzer() let spellChecker = SimpleSpellChecker(fsm);
To create an instance of this, both a
FsmMorphologicalAnalyzer and a
NGram is required.
FsmMorphologicalAnalyzer can be instantiated as follows:
let fsm = FsmMorphologicalAnalyzer()
NGram can be either trained from scratch or loaded from an existing model.
Training from scratch:
let corpus = Corpus("corpus.txt") let ngram = NGram(corpus.getAllWordsAsArrayList(), 1) ngram.calculateNGramProbabilities(LaplaceSmoothing())
There are many smoothing methods available. For other smoothing methods, check here.
Loading from an existing model:
let ngram = NGram("ngram.txt")
For further details, please check here.
NGramSpellChecker can be created as below:
let spellChecker = NGramSpellChecker(fsm, ngram)
Spell correction can be done as follows:
let sentence = Sentence("Dıktor olaç yazdı") let corrected = spellChecker.spellCheck(sentence)
Doktor ilaç yazdı
|Last commit: 2 weeks ago|