nltk.test.unit.lm package¶
Submodules¶
nltk.test.unit.lm.test_counter module¶
-
class
nltk.test.unit.lm.test_counter.
NgramCounterTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Tests for NgramCounter that only involve lookup, no modification.
nltk.test.unit.lm.test_models module¶
-
class
nltk.test.unit.lm.test_models.
KneserNeyInterpolatedTrigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
score_tests
= [('c', None, 0.125), ('z', None, 0.125), ('y', None, 0.125), ('c', ['b'], 0.4625), ('c', ['a', 'b'], 0.94625)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_score_4
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
LaplaceBigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
unit tests for Laplace class
-
score_tests
= [('d', ['c'], 0.2222222222222222), ('a', None, 0.13636363636363635), ('z', None, 0.045454545454545456), ('y', None, 0.18181818181818182)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
LidstoneBigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
unit tests for Lidstone class
-
score_tests
= [('d', ['c'], 0.6111111111111112), ('a', None, 0.14189189189189189), ('z', None, 0.006756756756756757), ('y', None, 0.20945945945945946)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
LidstoneTrigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
score_tests
= [('d', ['c'], 0.6111111111111112), ('e', ['c'], 0.05555555555555556), ('d', ['b', 'c'], 0.6111111111111112), ('e', ['b', 'c'], 0.05555555555555556)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
MleBigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
unit tests for MLENgramModel class
-
score_tests
= [('d', ['c'], 1), ('d', ['e'], 0), ('z', None, 0), ('a', None, 0.14285714285714285), ('y', None, 0.21428571428571427)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_score_4
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
MleTrigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
MLE trigram model tests
-
score_tests
= [('d', ('b', 'c'), 1), ('d', ['c'], 1), ('a', None, 0.1111111111111111), ('z', None, 0), ('y', None, 0.16666666666666666)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_score_4
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-
-
class
nltk.test.unit.lm.test_models.
NgramModelTextGenerationTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
Using MLE estimator, generate some text.
-
class
nltk.test.unit.lm.test_models.
ParametrizeTestsMeta
[source]¶ Bases:
type
Metaclass for generating parametrized tests.
-
class
nltk.test.unit.lm.test_models.
WittenBellInterpolatedTrigramTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
-
score_tests
= [('c', None, 0.05555555555555555), ('z', None, 0.0), ('y', None, 0.16666666666666666), ('c', ['b'], 0.45062222222222226), ('c', ['a', 'b'], 0.9633565022222222)]¶
-
test_score_0
()¶
-
test_score_1
()¶
-
test_score_2
()¶
-
test_score_3
()¶
-
test_score_4
()¶
-
test_sumto1_0
()¶
-
test_sumto1_1
()¶
-
test_sumto1_2
()¶
-
test_sumto1_3
()¶
-
test_sumto1_4
()¶
-
test_sumto1_5
()¶
-
test_sumto1_6
()¶
-
test_sumto1_7
()¶
-
test_sumto1_8
()¶
-