Commit efaabee2 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Add Python based test

parent 5d731df3
......@@ -4,3 +4,4 @@ grew_main.native
DATA_DIR
LOCAL
install_dev
__pycache__
\ No newline at end of file
test:
cd empty_rule && test.py && cd -
cd effective_commands && test.py && cd -
cd commands/add_node && test.py && cd -
cd commands/append_feats && test.py && cd -
cd commands/delete_edge_feat && test.py && cd -
cd commands/edge_feat_update && test.py && cd -
cd commands/manipulate_modified_edge && test.py && cd -
cd grep && test.py && cd -
cd lexicons/pattern && test.py && cd -
cd lexicons/percent && test.py && cd -
cd matching/matching_complex_edges && test.py && cd -
cd strategies/iter && test.py && cd -
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 N1 _ _ _ _ 0 root _ _
2 N2 _ _ _ _ 1 T _ _
3 new_node _ _ _ _ 4 F _ _
4 N3 _ _ _ _ 2 T _ _
1 N1 _ _ _ _ 0 root _ _
2 N2 _ _ _ _ 1 T _ _
3 N3 _ _ _ _ 2 T _ _
rule add {
pattern { X -[T]-> Y }
without { Y -> * }
commands { add_node Z :< Y; add_edge Y -[F]-> Z; Z.form="new_node"}
}
strat main { Onf (add) }
\ No newline at end of file
graph {
A -[E]-> B;
B -[E]-> C;
}
#! /usr/bin/env python3
import sys
import os
sys.path.append(os.getcwd() + '/../..')
from utils import *
print ("--------------- add_nodes ---------------")
success('grew_dev transform -grs code.grs -config sud -quiet -i 01_input.conll', '01_expected.conll')
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 Max Max PROPN _ _ 2 nsubj _ _
2 va aller VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _
3 à à ADP _ Definite=Def|Gender=Dummy+Masc|Number=Sing|PronType=Art 4 case _ _
4 bureau bureau NOUN _ Gender=Masc|Number=Sing 2 obl:arg _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 Max Max PROPN _ _ 2 nsubj _ _
2 va aller VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _
3 à à ADP _ Gender=Dummy 5 case _ _
4 le le DET _ Definite=Def|Gender=Masc|Number=Sing|PronType=Art 5 det _ _
5 bureau bureau NOUN _ Gender=Masc|Number=Sing 2 obl:arg _ _
rule r {
pattern { N1 [form="à"]; N2 [form="le"]; N1 < N2 }
commands {
append_feats "+" N2 ==> N1;
del_node N2;
}
}
strat main { Onf (r) }
#! /usr/bin/env python3
import sys
import os
sys.path.append(os.getcwd() + '/../..')
from utils import *
print ("--------------- appends feats ---------------")
success('grew_dev transform -grs code.grs -config sud -quiet -i 01_input.conll', '01_expected.conll')
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 comp@x _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 comp:obj@x _ _
rule r {
pattern { e:H -[2=obj]-> D; }
commands { del_feat e.2; }
}
strat main { Onf (r) }
#! /usr/bin/env python3
import sys
import os
sys.path.append(os.getcwd() + '/../..')
from utils import *
print ("--------------- delete_edge_feat ---------------")
success('grew_dev transform -grs code.grs -config sud -quiet -i 01_input.conll', '01_expected.conll')
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 case:obj@x _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 case _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 case:obj@x _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1|1 case|zzz:obj@x _ _
3 C _ _ _ _ 2|2 case|case:obj@x _ _
4 D _ _ _ _ 3 case _ _
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC
1 A _ _ _ _ 0 root _ _
2 B _ _ _ _ 1 case:obj@x _ _
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment