def test_it_delete_POSes_from_end_with_TreeTagger(self): kw_extractor = KeywordExtractor( os.path.join(self.script_folder, "test"), "small-mixed2.txt", self.output_folder) kw_extractor._fill_main_lang_dictionaries_with_tree_tagger() kw_extractor.proper_noun_with_names_set = {'don Chisciotte di'} kw_extractor.proper_noun_with_names_set = kw_extractor._delete_POSes_from_end_with_TreeTagger( kw_extractor.proper_noun_with_names_set, kw_extractor.tagger_it) self.assertEqual(kw_extractor.proper_noun_with_names_set, {'don Chisciotte'})
def test_de_proper_nouns_fill_main_lang_dictionaries_with_tree_tagger( self): """ Tests the class method of the KeywordExtractor _fill_main_lang_dictionaries_with_tree_tagger. Reads a file from the test folder and checks if proper nouns have been correctly detected by the method. """ kw_extractor = KeywordExtractor( os.path.join(self.script_folder, "test"), "small-mixed.txt", self.output_folder) kw_extractor._fill_main_lang_dictionaries_with_tree_tagger() self.assertEqual(kw_extractor.tree_taggers_proper_nouns, {'Nico', 'Pascal', 'DFB', 'Rosberg'})
def test_de_add_second_lang_proper_nouns(self): """ Tests the class method of the KeywordExtractor _add_second_lang_proper_nouns. Reads a file from the test folder with the majority of German text and checks if proper nouns and words from the Title and the Teaser have been correctly detected by the method. """ kw_extractor = KeywordExtractor( os.path.join(self.script_folder, "test"), "small-mixed.txt", self.output_folder) kw_extractor._fill_main_lang_dictionaries_with_tree_tagger() kw_extractor._add_second_lang_proper_nouns() self.assertEqual( kw_extractor.tree_taggers_proper_nouns, {'DFB', 'Bernardo', 'Magnagi', 'Pascal', 'Nico', 'Rosberg'})