def fracPronounRatio(dir_tweet): file_o = dir_tweet first_pronoun = 0 second_pronoun = 0 third_pronoun = 0 count = 0 with open(file_o,"r") as f: reader = csv.reader(f, delimiter="\t") for i, line in enumerate(reader): pronoun = pointofview.get_text_pov(line[8]) if pronoun == 'first': first_pronoun = first_pronoun + 1 if pronoun == 'second': second_pronoun = second_pronoun + 1 if pronoun == 'third': third_pronoun = third_pronoun + 1 count = count + 1 return first_pronoun/count, second_pronoun/count, third_pronoun/count
def test_none(): assert pointofview.get_text_pov(POV_NONE) == pointofview.NONE # nosec
def test_second(): assert pointofview.get_text_pov(POV_SECOND) == pointofview.SECOND # nosec
def test_third(): assert pointofview.get_text_pov(POV_THIRD) == pointofview.THIRD # nosec
def test_first(): assert pointofview.get_text_pov( POV_FIRST_SINGULAR) == pointofview.FIRST # nosec assert pointofview.get_text_pov( POV_FIRST_PLURAL) == pointofview.FIRST # nosec