Beispiel #1
0
 def test_noIDs(self):
     cooccCounter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_noIDs.txt", "s", "n", "10381", "10620"])
     cooccCounter.detect_and_run_option()
     with open("test_sources/gold_noIDs_new.txt") as gold, \
     open("results/cocounts_15_639_grouping_file_noIDs.txt_s_n_10381_10620.csv") as countIntOutput:
         goldString = gold.read()
         countIntOutputString = countIntOutput.read()
     self.failUnless(goldString == countIntOutputString)
Beispiel #2
0
 def test_simple_grouping_file_add(self):
     counter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_simpleGF2.txt", "s", "y", "10384", "10545"])
     counter.detect_and_run_option()
     with open("test_sources/gold_simple_grouping_file_2_new.csv") as gold, \
     open("results/cocounts_15_639_grouping_file_simpleGF2.txt_s_y_10384_10545.csv") as simpleGFoutput:
         goldString = gold.read()
         simpleGFoutputString = simpleGFoutput.read()
     self.failUnless(goldString == simpleGFoutputString)
Beispiel #3
0
 def test_or_with_three_groups(self):
     cooccCounter = CooccCounter(
         ["program", "15", "639", "all_texts.txt", "c", "y", "or5.txt"])
     cooccCounter.detect_and_run_option()
     with open("test_sources/gold_or_count5.txt") as gold, \
     open("results/cocounts_15_639_all_texts.txt_c_y_or5.txt.csv") as output:
         goldString = gold.read()
         countOutputString = output.read()
     self.failUnless(goldString == countOutputString)
Beispiel #4
0
 def test_count_with_suffix(self):
     cooccCounter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_count.txt", "c", "y","_suffix","10836", "11159"])
     cooccCounter.detect_and_run_option()
     with open("test_sources/gold_count.csv") as gold, \
     open("results/cocounts_15_639_suffix.csv") as countOutput:
         goldString = gold.read()
         countOutputString = countOutput.read()
     self.failUnless(goldString == countOutputString)
Beispiel #5
0
 def test_grouping_file_output_group_low(self):
     counter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_withGroups.txt", "s","y", "10024", "10445"])
     counter.detect_and_run_option()
     with open("test_sources/gold_ByLevel_low_new.csv") as gold, \
     open("results/cocounts_15_639_grouping_file_withGroups.txt_s_y_10024_10445_low.csv")\
     as output:
         goldString = gold.read()
         outputString = output.read()
     self.failUnless(goldString == outputString)
Beispiel #6
0
 def test_conceptSelectionByFile(self):
     cooccCounter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_conceptSelByFile.txt","s",\
     "y", "conceptSelection.txt"])
     cooccCounter.detect_and_run_option()
     with open("test_sources/gold_conceptSelByFile.txt") as gold, \
     open("results/cocounts_15_639_grouping_file_conceptSelByFile.txt_s_y_conceptSelection.txt.csv") as output:
         goldString = gold.read()
         outputString = output.read()
     self.failUnless(goldString == outputString)
Beispiel #7
0
 def test_count_with_suffix_and_concept_selection_file(self):
     cooccCounter = CooccCounter([
         "cocount_main.py", "15", "639", "grouping_file_count.txt", "c",
         "y", "_suffix2", "exampleConceptSelection.txt"
     ])
     cooccCounter.detect_and_run_option()
     with open("test_sources/gold_count.csv") as gold, \
     open("results/cocounts_15_639_suffix2.csv") as countOutput:
         goldString = gold.read()
         countOutputString = countOutput.read()
     self.failUnless(goldString == countOutputString)
Beispiel #8
0
 def test_detect_and_run_option_count(self):
     cooccCounter = CooccCounter(["cocount_main.py", "15", "639",\
     "grouping_file_count.txt", "c", "y","10836", "11159"])
     cooccCounter.detect_and_run_option()
     gold = open("test_sources/gold_count_additional_options.txt")
     output = open(
         "results/cocounts_15_639_grouping_file_count.txt_c_y_10836_11159.csv"
     )
     goldString = gold.read()
     outputString = output.read()
     gold.close()
     output.close()
     self.assertEqual(goldString, outputString)
Beispiel #9
0
 def test_count_with_concept_selection_file_with_duplicates(self):
     cooccCounter = CooccCounter(["cocount_main.py", "15", "639",\
     "all_texts.txt", "c", "y",\
     "conceptSelectionCountTestWithFileTwo.txt"])
     cooccCounter.detect_and_run_option()
     gold = open("test_sources/gold_count_test_with_file_two.csv")
     output = open(
         "results/cocounts_15_639_all_texts.txt_c_y_conceptSelectionCountTestWithFileTwo.txt.csv"
     )
     goldString = gold.read()
     outputString = output.read()
     gold.close()
     output.close()
     self.assertEqual(goldString, outputString)
Beispiel #10
0
 def test_concept_selection_any_count_with_suffix(self):
     counter = CooccCounter(["xy.py", "15", "639",\
     "all_texts.txt", "s","y", "_suffixAny","any"])
     counter.detect_and_run_option()
     self.assertEqual(counter.cooccScoreDict[("10017", "10035")], 1.122)