Skip to main content

Turkish Spell Checker Library

Project description

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 Cython, Java, C++, Swift, Js, or C# repository.

Requirements

Python

To check if you have a compatible version of Python installed, use the following command:

python -V

You can find the latest version of Python here.

Git

Install the latest version of Git.

Pip Install

pip3 install NlpToolkit-SpellChecker

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 SpellChecker will be created. Or you can use below link for exploring the code:

git clone https://github.com/starlangsoftware/TurkishSpellChecker-Py.git

Open project with Pycharm IDE

Steps for opening the cloned project:

  • Start IDE
  • Select File | Open from main menu
  • Choose DataStructure-PY file
  • Select open as project option
  • Couple of seconds, project will be downloaded.

Detailed Description

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.

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

    • To create an instance of this, both a FsmMorphologicalAnalyzer and a NGram is required.

    • FsmMorphologicalAnalyzer can be instantiated as follows:

        fsm = FsmMorphologicalAnalyzer()
      
    • NGram can be either trained from scratch or loaded from an existing model.

      • Training from scratch:

          corpus = Corpus("corpus.txt");
          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:

          ngram = NGram("ngram.txt")
        

    For further details, please check here.

    • Afterwards, NGramSpellChecker can be created as below:

        spellChecker = NGramSpellChecker(fsm, ngram)
      

Spell Correction

Spell correction can be done as follows:

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

Output:

Doktor ilaç yazdı

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

NlpToolkit-SpellChecker-1.0.26.tar.gz (25.6 kB view details)

Uploaded Source

File details

Details for the file NlpToolkit-SpellChecker-1.0.26.tar.gz.

File metadata

File hashes

Hashes for NlpToolkit-SpellChecker-1.0.26.tar.gz
Algorithm Hash digest
SHA256 05d044b33108907e6b3d5f388fa3b742bf3bfd15c726559b00400b59bb06d897
MD5 8654c6373f0033760ca46721d22c7eb0
BLAKE2b-256 37ac371e8d790e9f91c4bbb0151b75b03ddf7db4dad62fb15ad1ecc42fdcca6a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page