-
Notifications
You must be signed in to change notification settings - Fork 7
/
test_perturb.py
34 lines (31 loc) · 1.13 KB
/
test_perturb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from eva.perturb.perturb import *
name = "story"
data = [
{
'id': 0,
'ipt': "his parents were overweight .",
'truth': "he was overweight as well . so the doctors told his parents it was unhealthy . his parents understood and decided to make a change . they got themselves and him on a diet .",
},
{
'id': 1,
'ipt': "he was out jogging one morning .",
'truth': "the weather was crisp and cool . then , he felt good and energetic . he decided to keep running longer than normal . he went several more miles out of his way ."
},
]
method_list = [
lexical_rept(name, nlp=nlp),
semantic_rept(name, nlp=nlp),
character(name, nlp=nlp, pronoun_num=2),
consistency(name, nlp=nlp),
coherence(name, nlp=nlp),
commonsense(name, nlp=nlp, sub_num=1),
cause(name, nlp=nlp),
time(name, nlp=nlp),
synonym_substitute(name, nlp=nlp, sub_num=2),
semantic_substitute(name, nlp=nlp),
add_typos(name),
contraction(name),
delete_punct(name, nlp, punct_num=1),
]
for method in method_list:
method.construct(data)