Exemplo 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)
Exemplo 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)
Exemplo 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)
Exemplo n.º 4
0
 def sp(self, tokens):
     correct_word = spelling(tokens)
     return (correct_word)
Exemplo n.º 5
0
Arquivo: test.py Projeto: ach4l/LifeST
from pattern.en import spelling

word = "amazng"

correct_word = spelling(word)
print(correct_word)