예제 #1
0
def test_with_wordlist():
    checker = SpellingChecker(lang='en_US',
                              suggest=False,
                              word_list_filename=os.path.join(os.path.dirname(__file__),
                                                              'test_wordlist.txt')
                              )
    words = [ w for w, s in checker.check('This txt is wrong') ]
    assert not words, 'Did not use personal word list file'
    return
예제 #2
0
def test_with_suggestions():
    checker = SpellingChecker(lang='en_US',
                              suggest=True,
                              word_list_filename=None,
                              )
    for word, suggestions in checker.check('This txt is wrong'):
        assert suggestions, 'Not suggesting'
        assert word == 'txt'
    return
예제 #3
0
def test_errors_only():
    checker = SpellingChecker(lang='en_US',
                              suggest=False,
                              word_list_filename=None,
                              )
    for word, suggestions in checker.check('This txt is wrong'):
        assert not suggestions, 'Suggesting'
        assert word == 'txt'
    return
예제 #4
0
def test_with_wordlist():
    checker = SpellingChecker(lang='en_US',
                              suggest=False,
                              word_list_filename=os.path.join(
                                  os.path.dirname(__file__),
                                  'test_wordlist.txt'))
    words = [w for w, s in checker.check('This txt is wrong')]
    assert not words, 'Did not use personal word list file'
    return
예제 #5
0
def test_with_suggestions():
    checker = SpellingChecker(
        lang='en_US',
        suggest=True,
        word_list_filename=None,
    )
    for word, suggestions in checker.check('This txt is wrong'):
        assert suggestions, 'Not suggesting'
        assert word == 'txt'
    return
예제 #6
0
def test_errors_only():
    checker = SpellingChecker(
        lang='en_US',
        suggest=False,
        word_list_filename=None,
    )
    for word, suggestions in checker.check('This txt is wrong'):
        assert not suggestions, 'Suggesting'
        assert word == 'txt'
    return