Swiftpack.co - StarlangSoftware/TurkishSpellChecker-Swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by StarlangSoftware.
StarlangSoftware/TurkishSpellChecker-Swift 1.0.0
Turkish SpellChecker Library
⭐️ 0
🕓 31 weeks ago
.package(url: "https://github.com/StarlangSoftware/TurkishSpellChecker-Swift.git", from: "1.0.0")

Turkish Spell Checker

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.

Video Lectures

For Developers

You can also see Java, Python, Cython, C++, or C# repository.


  • Xcode Editor
  • Git


Install the latest version of Git.

Download Code

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

Open project with XCode

To import projects from Git with version control:

  • XCode IDE, select Clone an Existing Project.

  • In the Import window, paste github URL.

  • Click Clone.

Result: The imported project is listed in the Project Explorer view and files are loaded.


From IDE

After being done with the downloading and opening project, select Build option from Product menu. After compilation process, user can run TurkishSpellChecker-Swift.

For Developers

Creating SpellChecker

SpellChecker finds spelling errors and corrects them in Turkish. There are two types of spell checker available:

  • SimpleSpellChecker

    • To instantiate this, a FsmMorphologicalAnalyzer is needed.

        let fsm = FsmMorphologicalAnalyzer()
        let spellChecker = SimpleSpellChecker(fsm);  
  • NGramSpellChecker,

    • 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)

      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.

    • Afterwards, NGramSpellChecker can be created as below:

        let spellChecker = NGramSpellChecker(fsm, ngram)

Spell Correction

Spell correction can be done as follows:

let sentence = Sentence("Dıktor olaç yazdı")
let corrected = spellChecker.spellCheck(sentence)


Doktor ilaç yazdı


Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Initial release
31 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics