nltk.test.unit package
Submodules
nltk.test.unit.test_2x_compat module
Unit tests for nltk.compat.
See also nltk/test/compat.doctest.
-
class nltk.test.unit.test_2x_compat.TestTextTransliteration(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_repr()[source]
-
test_str()[source]
-
txt = <Text: São Tomé and Príncipe...>
-
nltk.test.unit.test_2x_compat.setup_module(module)[source]
nltk.test.unit.test_classify module
Unit tests for nltk.classify. See also: nltk/test/classify.doctest
-
nltk.test.unit.test_classify.assert_classifier_correct(algorithm)[source]
-
nltk.test.unit.test_classify.test_megam()[source]
-
nltk.test.unit.test_classify.test_tadm()[source]
nltk.test.unit.test_collocations module
-
class nltk.test.unit.test_collocations.TestBigram(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_bigram2()[source]
-
test_bigram3()[source]
-
test_bigram5()[source]
-
nltk.test.unit.test_collocations.close_enough(x, y)[source]
Verify that two sequences of n-gram association values are within
_EPSILON of each other.
nltk.test.unit.test_corpora module
-
class nltk.test.unit.test_corpora.TestCess(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_catalan()[source]
-
test_esp()[source]
-
class nltk.test.unit.test_corpora.TestCoNLL2007(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_parsed_sents()[source]
-
test_sents()[source]
-
class nltk.test.unit.test_corpora.TestFloresta(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_words()[source]
-
class nltk.test.unit.test_corpora.TestIndian(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_tagged_words()[source]
-
test_words()[source]
-
class nltk.test.unit.test_corpora.TestPTB(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_categories()[source]
-
test_category_words()[source]
-
test_fileids()[source]
-
test_news_fileids()[source]
-
test_tagged_words()[source]
-
test_words()[source]
-
class nltk.test.unit.test_corpora.TestSinicaTreebank(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_parsed_sents()[source]
-
test_sents()[source]
-
class nltk.test.unit.test_corpora.TestUdhr(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_raw_unicode()[source]
-
test_words()[source]
nltk.test.unit.test_corpus_views module
Corpus View Regression Tests
-
class nltk.test.unit.test_corpus_views.TestCorpusViews(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
data()[source]
-
linetok = <nltk.tokenize.simple.LineTokenizer object at 0x14ba08240>
-
names = ['corpora/inaugural/README', 'corpora/inaugural/1793-Washington.txt', 'corpora/inaugural/1909-Taft.txt']
-
test_correct_length()[source]
-
test_correct_values()[source]
nltk.test.unit.test_hmm module
-
nltk.test.unit.test_hmm.setup_module(module)[source]
-
nltk.test.unit.test_hmm.test_backward_probability()[source]
-
nltk.test.unit.test_hmm.test_forward_probability()[source]
-
nltk.test.unit.test_hmm.test_forward_probability2()[source]
nltk.test.unit.test_naivebayes module
-
class nltk.test.unit.test_naivebayes.NaiveBayesClassifierTest(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_simple()[source]
nltk.test.unit.test_seekable_unicode_stream_reader module
The following test performs a random series of reads, seeks, and
tells, and checks that the results are consistent.
-
nltk.test.unit.test_seekable_unicode_stream_reader.check_reader(unicode_string, encoding, n=1000)[source]
-
nltk.test.unit.test_seekable_unicode_stream_reader.teardown_module(module=None)[source]
-
nltk.test.unit.test_seekable_unicode_stream_reader.test_reader()[source]
-
nltk.test.unit.test_seekable_unicode_stream_reader.test_reader_on_large_string()[source]
nltk.test.unit.test_stem module
-
class nltk.test.unit.test_stem.SnowballTest(methodName='runTest')[source]
Bases: unittest.case.TestCase
-
test_german()[source]
-
test_russian()[source]
-
test_short_strings_bug()[source]
-
test_spanish()[source]
nltk.test.unit.test_tag module
-
nltk.test.unit.test_tag.setup_module(module)[source]
-
nltk.test.unit.test_tag.test_basic()[source]
nltk.test.unit.test_tgrep module
Unit tests for nltk.tgrep.
-
class nltk.test.unit.test_tgrep.TestSequenceFunctions(methodName='runTest')[source]
Bases: unittest.case.TestCase
Class containing unit tests for nltk.tgrep.
-
test_bad_operator()[source]
Test error handling of undefined tgrep operators.
Test that comments are correctly filtered out of tgrep search
strings.
-
test_examples()[source]
Test the Basic Examples from the TGrep2 manual.
-
test_labeled_nodes()[source]
Test labeled nodes.
Test case from Emily M. Bender.
-
test_multiple_conjs()[source]
Test that multiple (3 or more) conjunctions of node relations are
handled properly.
-
test_node_encoding()[source]
Test that tgrep search strings handles bytes and strs the same
way.
-
test_node_nocase()[source]
Test selecting nodes using case insensitive node names.
-
test_node_noleaves()[source]
Test node name matching with the search_leaves flag set to False.
-
test_node_printing()[source]
Test that the tgrep print operator ‘ is properly ignored.
-
test_node_quoted()[source]
Test selecting nodes using quoted node names.
-
test_node_regex()[source]
Test regex matching on nodes.
-
test_node_regex_2()[source]
Test regex matching on nodes.
-
test_node_simple()[source]
Test a simple use of tgrep for finding nodes matching a given
pattern.
-
test_node_tree_position()[source]
Test matching on nodes based on NLTK tree position.
-
test_rel_precedence()[source]
Test matching nodes based on precedence relations.
-
test_rel_sister_nodes()[source]
Test matching sister nodes in a tree.
-
test_tokenize_encoding()[source]
Test that tokenization handles bytes and strs the same way.
-
test_tokenize_examples()[source]
Test tokenization of the TGrep2 manual example patterns.
-
test_tokenize_link_types()[source]
Test tokenization of basic link types.
-
test_tokenize_macros()[source]
Test tokenization of macro definitions.
-
test_tokenize_node_labels()[source]
Test tokenization of labeled nodes.
-
test_tokenize_nodenames()[source]
Test tokenization of node names.
-
test_tokenize_quoting()[source]
Test tokenization of quoting.
-
test_tokenize_segmented_patterns()[source]
Test tokenization of segmented patterns.
-
test_tokenize_simple()[source]
Simple test of tokenization.
-
test_trailing_semicolon()[source]
Test that semicolons at the end of a tgrep2 search string won’t
cause a parse failure.
-
test_use_macros()[source]
Test defining and using tgrep2 macros.
-
tests_rel_dominance()[source]
Test matching nodes based on dominance relations.
-
tests_rel_indexed_children()[source]
Test matching nodes based on their index in their parent node.
nltk.test.unit.utils module
-
nltk.test.unit.utils.skip(reason)[source]
Unconditionally skip a test.
-
nltk.test.unit.utils.skipIf(condition, reason)[source]
Skip a test if the condition is true.
Module contents