Esempio n. 1
0
 def test_spelling(self):
     # Assert spelling suggestion accuracy.
     i = j = 0.0
     from pattern.db import Datasheet
     for correct, wrong in Datasheet.load(os.path.join(PATH, "corpora", "birkbeck-spelling.csv")):
         for w in wrong.split(" "):
             if en.spelling(w)[0][0] == correct:
                 i += 1
             else:
                 j += 1
     self.assertTrue(i / (i+j) > 0.70)
Esempio n. 2
0
 def test_spelling(self):
     # Assert spelling suggestion accuracy.
     # Note: simply training on more text will not improve accuracy.
     i = j = 0.0
     from pattern.db import Datasheet
     for correct, wrong in Datasheet.load(os.path.join(PATH, "corpora", "spelling-birkbeck.csv")):
         for w in wrong.split(" "):
             if en.spelling(w)[0][0] == correct:
                 i += 1
             else:
                 j += 1
     self.assertTrue(i / (i+j) > 0.70)
Esempio n. 3
0
 def test_spelling(self):
     # Assert spelling suggestion accuracy.
     # Note: simply training on more text will not improve accuracy.
     i = j = 0.0
     from pattern.db import Datasheet
     for correct, wrong in Datasheet.load(os.path.join(PATH, "corpora", "birkbeck-spelling.csv")):
         for w in wrong.split(" "):
             if en.spelling(w)[0][0] == correct:
                 i += 1
             else:
                 j += 1
     self.assertTrue(i / (i+j) > 0.70)
Esempio n. 4
0
 def sp(self, tokens):
     correct_word = spelling(tokens)
     return (correct_word)
Esempio n. 5
0
File: test.py Progetto: ach4l/LifeST
from pattern.en import spelling

word = "amazng"

correct_word = spelling(word)
print(correct_word)