예제 #1
0
파일: test_en.py 프로젝트: theorm/pattern
 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)
예제 #2
0
파일: test_en.py 프로젝트: aburan28/pattern
 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)
예제 #3
0
파일: test_en.py 프로젝트: xu-hong/pattern
 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)
예제 #4
0
파일: resources.py 프로젝트: bathurstAi/NLP
 def sp(self, tokens):
     correct_word = spelling(tokens)
     return (correct_word)
예제 #5
0
파일: test.py 프로젝트: ach4l/LifeST
from pattern.en import spelling

word = "amazng"

correct_word = spelling(word)
print(correct_word)