Module Expr Str Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore TupleLoad Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad Num Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ListLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Num Assign NameStore Call NameLoad Assign AttributeStore NameLoad attr TupleLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad TupleLoad Num Num Assign NameStore BinOpMult Call NameLoad AttributeLoad NameLoad attr BinOpSub Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Num Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad TupleLoad Num Num Expr Call AttributeLoad NameLoad attr NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore TupleLoad Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index Num BinOpAdd AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr TupleLoad Str Index Num attr Call AttributeLoad NameLoad attr TupleLoad Str Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index Num BinOpAdd AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr TupleLoad Str Str Index Num attr Call AttributeLoad NameLoad attr TupleLoad Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore TupleLoad Str Str Str Str Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad NameLoad Index Num Index Num BinOpAdd SubscriptLoad SubscriptLoad NameLoad Index Num Index Num SubscriptLoad SubscriptLoad NameLoad Index Num Index Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Assign AttributeStore NameLoad attr Lambda arguments args NameParam defaults ListLoad TupleLoad Num Num TupleLoad Num Num Assign NameStore Call NameLoad Lambda arguments args defaults Call NameLoad NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Num Index Num Num Assign SubscriptStore SubscriptLoad NameLoad Index Num Index Num Num Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad BinOpAdd Num Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Assign AttributeStore NameLoad attr Lambda arguments args NameParam defaults ListLoad TupleLoad Num Num TupleLoad Num Num Assign NameStore ListLoad ListLoad Num Num ListLoad Num ListLoad ListLoad Num ListLoad Num Num Num ListLoad ListLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad ListLoad TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num decorator_list FunctionDef arguments args defaults body Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr TupleLoad Str TupleLoad Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str Str TupleLoad Str Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str Str TupleLoad Str Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str TupleLoad Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str TupleLoad Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str Str TupleLoad Str Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str TupleLoad Str Str Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str Str Str TupleLoad Str Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str TupleLoad Str Num Expr Call AttributeLoad NameLoad attr TupleLoad Str TupleLoad Str Num Return NameLoad decorator_list NameLoad FunctionDef arguments args defaults body Assign NameStore Call NameLoad Lambda arguments args defaults Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Call NameLoad Num Assign SubscriptStore NameLoad Index TupleLoad Str Str Call NameLoad Num Assign NameStore Call Call NameLoad Str TupleLoad NameLoad Dict Str Lambda arguments args NameParam NameParam defaults SubscriptLoad NameLoad Index NameLoad Return NameLoad decorator_list NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call NameLoad keyword Num keyword TupleLoad Num Num keyword TupleLoad Str Str keyword NameLoad Assign NameStore Call NameLoad keyword Num keyword TupleLoad Num Num keyword TupleLoad Str Str keyword NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Str Str Str Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad ListLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr NameLoad Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad ListLoad Num Num Num Num Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Expr Call AttributeLoad NameLoad attr NameLoad ListLoad TupleLoad Num Num TupleLoad Num Num TupleLoad Num Num decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad ListLoad TupleLoad Num Num decorator_list decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr CompareIn NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Num Num Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr CompareIn NameLoad NameLoad Expr Call AttributeLoad NameLoad attr CompareIn NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Num Num Assign NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr CompareIn NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Num Assign NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A 
Tests for stack decoder
 N/A unittest collections defaultdict math log nltk.translate PhraseTable nltk.translate StackDecoder nltk.translate.stack_decoder _Hypothesis _Stack TestStackDecoder N/A N/A unittest TestCase N/A test_find_all_src_phrases N/A N/A self N/A N/A N/A phrase_table N/A N/A TestStackDecoder create_fake_phrase_table N/A stack_decoder N/A StackDecoder phrase_table None N/A sentence N/A my hovercraft is full of eels N/A src_phrase_spans N/A N/A stack_decoder find_all_src_phrases sentence N/A N/A N/A self assertEqual N/A src_phrase_spans N/A 0 N/A 2 N/A N/A N/A self assertEqual N/A src_phrase_spans N/A 1 N/A 2 N/A N/A N/A self assertEqual N/A src_phrase_spans N/A 2 N/A 3 N/A N/A N/A self assertEqual N/A src_phrase_spans N/A 3 N/A 5 6 N/A N/A N/A self assertFalse N/A src_phrase_spans N/A 4 N/A N/A N/A self assertEqual N/A src_phrase_spans N/A 5 N/A 6 N/A test_distortion_score N/A N/A self N/A N/A N/A stack_decoder N/A StackDecoder None None N/A N/A stack_decoder distortion_factor 0.5 N/A hypothesis N/A _Hypothesis N/A N/A hypothesis src_phrase_span N/A 3 5 N/A score N/A N/A stack_decoder distortion_score hypothesis N/A 8 10 N/A expected_score N/A N/A log N/A stack_decoder distortion_factor N/A 8 5 N/A N/A N/A self assertEqual score expected_score N/A test_distortion_score_of_first_expansion N/A N/A self N/A N/A N/A stack_decoder N/A StackDecoder None None N/A N/A stack_decoder distortion_factor 0.5 N/A hypothesis N/A _Hypothesis N/A score N/A N/A stack_decoder distortion_score hypothesis N/A 8 10 N/A N/A N/A self assertEqual score 0.0 N/A test_compute_future_costs N/A N/A self N/A N/A N/A phrase_table N/A N/A TestStackDecoder create_fake_phrase_table N/A language_model N/A N/A TestStackDecoder create_fake_language_model N/A stack_decoder N/A StackDecoder phrase_table language_model N/A sentence N/A my hovercraft is full of eels N/A future_scores N/A N/A stack_decoder compute_future_scores sentence N/A N/A N/A self assertEqual N/A N/A future_scores N/A 1 N/A 2 N/A N/A N/A N/A N/A phrase_table translations_for N/A hovercraft N/A 0 log_prob N/A N/A language_model probability N/A hovercraft N/A N/A N/A self assertEqual N/A N/A future_scores N/A 0 N/A 2 N/A N/A N/A N/A N/A phrase_table translations_for N/A my hovercraft N/A 0 log_prob N/A N/A language_model probability N/A my hovercraft N/A test_compute_future_costs_for_phrases_not_in_phrase_table N/A N/A self N/A N/A N/A phrase_table N/A N/A TestStackDecoder create_fake_phrase_table N/A language_model N/A N/A TestStackDecoder create_fake_language_model N/A stack_decoder N/A StackDecoder phrase_table language_model N/A sentence N/A my hovercraft is full of eels N/A future_scores N/A N/A stack_decoder compute_future_scores sentence N/A N/A N/A self assertEqual N/A N/A future_scores N/A 1 N/A 3 N/A N/A N/A future_scores N/A 1 N/A 2 N/A N/A future_scores N/A 2 N/A 3 N/A test_future_score N/A N/A self N/A N/A N/A hypothesis N/A _Hypothesis N/A N/A hypothesis untranslated_spans N/A N/A N/A _ N/A N/A N/A 0 2 N/A 5 8 N/A future_score_table N/A defaultdict N/A N/A N/A N/A N/A defaultdict float N/A N/A N/A future_score_table N/A 0 N/A 2 0.4 N/A N/A N/A future_score_table N/A 5 N/A 8 0.5 N/A stack_decoder N/A StackDecoder None None N/A future_score N/A N/A stack_decoder future_score hypothesis future_score_table 8 N/A N/A N/A self assertEqual future_score N/A 0.4 0.5 N/A test_valid_phrases N/A N/A self N/A N/A N/A hypothesis N/A _Hypothesis N/A N/A hypothesis untranslated_spans N/A N/A N/A _ N/A N/A N/A 0 2 N/A 3 6 N/A all_phrases_from N/A N/A 1 4 N/A 2 N/A N/A 5 N/A 5 6 7 N/A N/A 7 N/A phrase_spans N/A N/A StackDecoder valid_phrases all_phrases_from hypothesis N/A N/A N/A self assertEqual phrase_spans N/A N/A 0 1 N/A 1 2 N/A 3 5 N/A 4 5 N/A 4 6 N/A create_fake_phrase_table N/A N/A N/A N/A N/A phrase_table N/A PhraseTable N/A N/A N/A phrase_table add N/A hovercraft N/A 0.8 N/A N/A N/A phrase_table add N/A my hovercraft N/A 0.7 N/A N/A N/A phrase_table add N/A my cheese N/A 0.7 N/A N/A N/A phrase_table add N/A is N/A 0.8 N/A N/A N/A phrase_table add N/A is N/A 0.5 N/A N/A N/A phrase_table add N/A full of N/A 0.01 N/A N/A N/A phrase_table add N/A full of eels N/A 0.5 N/A N/A N/A phrase_table add N/A full of spam N/A 0.5 N/A N/A N/A phrase_table add N/A eels N/A 0.5 N/A N/A N/A phrase_table add N/A spam N/A 0.5 N/A phrase_table N/A staticmethod create_fake_language_model N/A N/A N/A N/A N/A language_prob N/A defaultdict N/A N/A N/A N/A -999.0 N/A N/A language_prob N/A N/A my N/A log 0.1 N/A N/A language_prob N/A N/A hovercraft N/A log 0.1 N/A N/A language_prob N/A N/A is N/A log 0.1 N/A N/A language_prob N/A N/A full N/A log 0.1 N/A N/A language_prob N/A N/A of N/A log 0.1 N/A N/A language_prob N/A N/A eels N/A log 0.1 N/A N/A language_prob N/A N/A my hovercraft N/A log 0.3 N/A language_model N/A N/A type N/A object N/A probability N/A N/A N/A _ phrase N/A N/A language_prob N/A phrase N/A language_model N/A staticmethod N/A TestHypothesis N/A N/A unittest TestCase N/A setUp N/A N/A self N/A N/A N/A root N/A _Hypothesis N/A child N/A _Hypothesis raw_score 0.5 src_phrase_span N/A 3 7 trg_phrase N/A hello world previous root N/A grandchild N/A _Hypothesis raw_score 0.4 src_phrase_span N/A 1 2 trg_phrase N/A and goodbye previous child N/A N/A self hypothesis_chain grandchild N/A test_translation_so_far N/A N/A self N/A N/A N/A translation N/A N/A N/A self hypothesis_chain translation_so_far N/A N/A N/A self assertEqual translation N/A hello world and goodbye N/A test_translation_so_far_for_empty_hypothesis N/A N/A self N/A N/A N/A hypothesis N/A _Hypothesis N/A translation N/A N/A hypothesis translation_so_far N/A N/A N/A self assertEqual translation N/A N/A test_total_translated_words N/A N/A self N/A N/A N/A total_translated_words N/A N/A N/A self hypothesis_chain total_translated_words N/A N/A N/A self assertEqual total_translated_words 5 N/A test_translated_positions N/A N/A self N/A N/A N/A translated_positions N/A N/A N/A self hypothesis_chain translated_positions N/A N/A N/A translated_positions sort N/A N/A N/A self assertEqual translated_positions N/A 1 3 4 5 6 N/A test_untranslated_spans N/A N/A self N/A N/A N/A untranslated_spans N/A N/A N/A self hypothesis_chain untranslated_spans 10 N/A N/A N/A self assertEqual untranslated_spans N/A N/A 0 1 N/A 2 3 N/A 7 10 N/A test_untranslated_spans_for_empty_hypothesis N/A N/A self N/A N/A N/A hypothesis N/A _Hypothesis N/A untranslated_spans N/A N/A hypothesis untranslated_spans 10 N/A N/A N/A self assertEqual untranslated_spans N/A N/A 0 10 N/A N/A TestStack N/A N/A unittest TestCase N/A test_push_bumps_off_worst_hypothesis_when_stack_is_full N/A N/A self N/A N/A N/A stack N/A _Stack 3 N/A poor_hypothesis N/A _Hypothesis 0.01 N/A N/A N/A stack push N/A _Hypothesis 0.2 N/A N/A N/A stack push poor_hypothesis N/A N/A N/A stack push N/A _Hypothesis 0.1 N/A N/A N/A stack push N/A _Hypothesis 0.3 N/A N/A N/A self assertFalse N/A poor_hypothesis stack N/A test_push_removes_hypotheses_that_fall_below_beam_threshold N/A N/A self N/A N/A N/A stack N/A _Stack 3 0.5 N/A poor_hypothesis N/A _Hypothesis 0.01 N/A worse_hypothesis N/A _Hypothesis 0.009 N/A N/A N/A stack push poor_hypothesis N/A N/A N/A stack push worse_hypothesis N/A N/A N/A stack push N/A _Hypothesis 0.9 N/A N/A N/A self assertFalse N/A poor_hypothesis stack N/A N/A N/A self assertFalse N/A worse_hypothesis stack N/A test_push_does_not_add_hypothesis_that_falls_below_beam_threshold N/A N/A self N/A N/A N/A stack N/A _Stack 3 0.5 N/A poor_hypothesis N/A _Hypothesis 0.01 N/A N/A N/A stack push N/A _Hypothesis 0.9 N/A N/A N/A stack push poor_hypothesis N/A N/A N/A self assertFalse N/A poor_hypothesis stack N/A test_best_returns_the_best_hypothesis N/A N/A self N/A N/A N/A stack N/A _Stack 3 N/A best_hypothesis N/A _Hypothesis 0.99 N/A N/A N/A stack push N/A _Hypothesis 0.0 N/A N/A N/A stack push best_hypothesis N/A N/A N/A stack push N/A _Hypothesis 0.5 N/A N/A N/A self assertEqual N/A N/A stack best best_hypothesis N/A test_best_returns_none_when_stack_is_empty N/A N/A self N/A N/A N/A stack N/A _Stack 3 N/A N/A N/A self assertEqual N/A N/A stack best None N/A N/A