コード例 #1
0
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
コード例 #2
0
def test_none():
    assert pointofview.get_text_pov(POV_NONE) == pointofview.NONE  # nosec
コード例 #3
0
def test_second():
    assert pointofview.get_text_pov(POV_SECOND) == pointofview.SECOND  # nosec
コード例 #4
0
def test_third():
    assert pointofview.get_text_pov(POV_THIRD) == pointofview.THIRD  # nosec
コード例 #5
0
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