nltk.test.unit.translate package

Submodules

nltk.test.unit.translate.test_bleu module

Tests for BLEU translation evaluation metric

class nltk.test.unit.translate.test_bleu.TestBLEU(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_brevity_penalty()[source]
test_full_matches()[source]
test_modified_precision()[source]

Examples from the original BLEU paper http://www.aclweb.org/anthology/P02-1040.pdf

test_partial_matches_hypothesis_longer_than_reference()[source]
test_zero_matches()[source]
class nltk.test.unit.translate.test_bleu.TestBLEUFringeCases(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_case_where_n_is_bigger_than_hypothesis_length()[source]
test_empty_hypothesis()[source]
test_empty_references()[source]
test_empty_references_and_hypothesis()[source]
test_reference_or_hypothesis_shorter_than_fourgrams()[source]
class nltk.test.unit.translate.test_bleu.TestBLEUvsMteval13a(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_corpus_bleu()[source]

nltk.test.unit.translate.test_ibm1 module

Tests for IBM Model 1 training methods

class nltk.test.unit.translate.test_ibm1.TestIBMModel1(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_prob_t_a_given_s()[source]
test_set_uniform_translation_probabilities()[source]
test_set_uniform_translation_probabilities_of_non_domain_values()[source]

nltk.test.unit.translate.test_ibm2 module

Tests for IBM Model 2 training methods

class nltk.test.unit.translate.test_ibm2.TestIBMModel2(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_prob_t_a_given_s()[source]
test_set_uniform_alignment_probabilities()[source]
test_set_uniform_alignment_probabilities_of_non_domain_values()[source]

nltk.test.unit.translate.test_ibm3 module

Tests for IBM Model 3 training methods

class nltk.test.unit.translate.test_ibm3.TestIBMModel3(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_prob_t_a_given_s()[source]
test_set_uniform_distortion_probabilities()[source]
test_set_uniform_distortion_probabilities_of_non_domain_values()[source]

nltk.test.unit.translate.test_ibm4 module

Tests for IBM Model 4 training methods

class nltk.test.unit.translate.test_ibm4.TestIBMModel4(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_prob_t_a_given_s()[source]
test_set_uniform_distortion_probabilities_of_max_displacements()[source]
test_set_uniform_distortion_probabilities_of_non_domain_values()[source]

nltk.test.unit.translate.test_ibm5 module

Tests for IBM Model 5 training methods

class nltk.test.unit.translate.test_ibm5.TestIBMModel5(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_prob_t_a_given_s()[source]
test_prune()[source]
test_set_uniform_vacancy_probabilities_of_max_displacements()[source]
test_set_uniform_vacancy_probabilities_of_non_domain_values()[source]

nltk.test.unit.translate.test_ibm_model module

Tests for common methods of IBM translation models

class nltk.test.unit.translate.test_ibm_model.TestIBMModel(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_best_model2_alignment()[source]
test_best_model2_alignment_does_not_change_pegged_alignment()[source]
test_best_model2_alignment_handles_empty_src_sentence()[source]
test_best_model2_alignment_handles_empty_trg_sentence()[source]
test_best_model2_alignment_handles_fertile_words()[source]
test_hillclimb()[source]
test_neighboring_finds_neighbor_alignments()[source]
test_neighboring_returns_neighbors_with_pegged_alignment()[source]
test_neighboring_sets_neighbor_alignment_info()[source]
test_sample()[source]
test_vocabularies_are_initialized()[source]
test_vocabularies_are_initialized_even_with_empty_corpora()[source]

nltk.test.unit.translate.test_stack_decoder module

Tests for stack decoder

class nltk.test.unit.translate.test_stack_decoder.TestHypothesis(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_total_translated_words()[source]
test_translated_positions()[source]
test_translation_so_far()[source]
test_translation_so_far_for_empty_hypothesis()[source]
test_untranslated_spans()[source]
test_untranslated_spans_for_empty_hypothesis()[source]
class nltk.test.unit.translate.test_stack_decoder.TestStack(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_best_returns_none_when_stack_is_empty()[source]
test_best_returns_the_best_hypothesis()[source]
test_push_bumps_off_worst_hypothesis_when_stack_is_full()[source]
test_push_does_not_add_hypothesis_that_falls_below_beam_threshold()[source]
test_push_removes_hypotheses_that_fall_below_beam_threshold()[source]
class nltk.test.unit.translate.test_stack_decoder.TestStackDecoder(methodName='runTest')[source]

Bases: unittest.case.TestCase

static create_fake_language_model()[source]
static create_fake_phrase_table()[source]
test_compute_future_costs()[source]
test_compute_future_costs_for_phrases_not_in_phrase_table()[source]
test_distortion_score()[source]
test_distortion_score_of_first_expansion()[source]
test_find_all_src_phrases()[source]
test_future_score()[source]
test_valid_phrases()[source]

Module contents