Skip to content

Commit

Permalink
Merge pull request #60 from kylebgorman/test
Browse files Browse the repository at this point in the history
Adds test of training/predict cycle.
  • Loading branch information
kylebgorman authored Oct 28, 2024
2 parents 91a467d + 58528b9 commit 19bbee7
Show file tree
Hide file tree
Showing 13 changed files with 1,676 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.conllu
*.pyc
*.ipynb

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ build>=1.2.1
flake8>=7.1.0
jsonargparse[signatures]>=4.32.0
lightning>=2.4.0
parameterized>=0.9.0
pytest>=7.4.4
transformers>=4.44.0
torch>=2.4.0
Expand Down
5 changes: 5 additions & 0 deletions tests/testdata/datasets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This directory contains small "toy" samples drawn from Universal Dependencies
data for English, Greek, and Russian for `udtube_test.py`. The `_train.conllu`
files are used to train and validate the model, and the `_expected.conllu`
files are the result of applying the model to the training data.
Each file contains ten sentences.
270 changes: 270 additions & 0 deletions tests/testdata/datasets/el_expected.conllu

Large diffs are not rendered by default.

270 changes: 270 additions & 0 deletions tests/testdata/datasets/el_train.conllu

Large diffs are not rendered by default.

246 changes: 246 additions & 0 deletions tests/testdata/datasets/en_expected.conllu

Large diffs are not rendered by default.

246 changes: 246 additions & 0 deletions tests/testdata/datasets/en_train.conllu
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
# newdoc id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000
# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0001
# newpar id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-p0001
# text = Al-Zaman : American forces killed Shaikh Abdullah al-Ani, the preacher at the mosque in the town of Qaim, near the Syrian border.
1 Al Al PROPN NNP Number=Sing 0 root 0:root SpaceAfter=No
2 - - PUNCT HYPH _ 3 punct 3:punct SpaceAfter=No
3 Zaman Zaman PROPN NNP Number=Sing 1 flat 1:flat _
4 : : PUNCT : _ 7 punct 7:punct _
5 American American ADJ JJ Degree=Pos 6 amod 6:amod _
6 forces force NOUN NNS Number=Plur 7 nsubj 7:nsubj _
7 killed kill VERB VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 1 parataxis 1:parataxis _
8 Shaikh Shaikh PROPN NNP Number=Sing 7 obj 7:obj _
9 Abdullah Abdullah PROPN NNP Number=Sing 8 flat 8:flat _
10 al al PROPN NNP Number=Sing 8 flat 8:flat SpaceAfter=No
11 - - PUNCT HYPH _ 12 punct 12:punct SpaceAfter=No
12 Ani Ani PROPN NNP Number=Sing 8 flat 8:flat SpaceAfter=No
13 , , PUNCT , _ 15 punct 15:punct _
14 the the DET DT Definite=Def|PronType=Art 15 det 15:det _
15 preacher preacher NOUN NN Number=Sing 8 appos 8:appos _
16 at at ADP IN _ 18 case 18:case _
17 the the DET DT Definite=Def|PronType=Art 18 det 18:det _
18 mosque mosque NOUN NN Number=Sing 15 nmod 15:nmod:at _
19 in in ADP IN _ 21 case 21:case _
20 the the DET DT Definite=Def|PronType=Art 21 det 21:det _
21 town town NOUN NN Number=Sing 18 nmod 18:nmod:in _
22 of of ADP IN _ 23 case 23:case _
23 Qaim Qaim PROPN NNP Number=Sing 21 nmod 21:nmod:of SpaceAfter=No
24 , , PUNCT , _ 28 punct 28:punct _
25 near near ADP IN _ 28 case 28:case _
26 the the DET DT Definite=Def|PronType=Art 28 det 28:det _
27 Syrian Syrian ADJ JJ Degree=Pos 28 amod 28:amod _
28 border border NOUN NN Number=Sing 21 nmod 21:nmod:near SpaceAfter=No
29 . . PUNCT . _ 1 punct 1:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0002
# text = [This killing of a respected cleric will be causing us trouble for years to come.]
1 [ [ PUNCT -LRB- _ 10 punct 10:punct SpaceAfter=No
2 This this DET DT Number=Sing|PronType=Dem 3 det 3:det _
3 killing killing NOUN NN Number=Sing 10 nsubj 10:nsubj _
4 of of ADP IN _ 7 case 7:case _
5 a a DET DT Definite=Ind|PronType=Art 7 det 7:det _
6 respected respected ADJ JJ Degree=Pos 7 amod 7:amod _
7 cleric cleric NOUN NN Number=Sing 3 nmod 3:nmod:of _
8 will will AUX MD VerbForm=Fin 10 aux 10:aux _
9 be be AUX VB VerbForm=Inf 10 aux 10:aux _
10 causing cause VERB VBG Tense=Pres|VerbForm=Part 0 root 0:root _
11 us we PRON PRP Case=Acc|Number=Plur|Person=1|PronType=Prs 10 iobj 10:iobj _
12 trouble trouble NOUN NN Number=Sing 10 obj 10:obj _
13 for for ADP IN _ 14 case 14:case _
14 years year NOUN NNS Number=Plur 10 obl 10:obl:for _
15 to to PART TO _ 16 mark 16:mark _
16 come come VERB VB VerbForm=Inf 14 acl 14:acl:to SpaceAfter=No
17 . . PUNCT . _ 10 punct 10:punct SpaceAfter=No
18 ] ] PUNCT -RRB- _ 10 punct 10:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0003
# text = DPA: Iraqi authorities announced that they had busted up 3 terrorist cells operating in Baghdad.
1 DPA DPA PROPN NNP Number=Sing 0 root 0:root SpaceAfter=No
2 : : PUNCT : _ 5 punct 5:punct _
3 Iraqi Iraqi ADJ JJ Degree=Pos 4 amod 4:amod _
4 authorities authority NOUN NNS Number=Plur 5 nsubj 5:nsubj _
5 announced announce VERB VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 1 parataxis 1:parataxis _
6 that that SCONJ IN _ 9 mark 9:mark _
7 they they PRON PRP Case=Nom|Number=Plur|Person=3|PronType=Prs 9 nsubj 9:nsubj _
8 had have AUX VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 9 aux 9:aux _
9 busted bust VERB VBN Tense=Past|VerbForm=Part 5 ccomp 5:ccomp _
10 up up ADP RP _ 9 compound:prt 9:compound:prt _
11 3 3 NUM CD NumForm=Digit|NumType=Card 13 nummod 13:nummod _
12 terrorist terrorist ADJ JJ Degree=Pos 13 amod 13:amod _
13 cells cell NOUN NNS Number=Plur 9 obj 9:obj _
14 operating operate VERB VBG VerbForm=Ger 13 acl 13:acl _
15 in in ADP IN _ 16 case 16:case _
16 Baghdad Baghdad PROPN NNP Number=Sing 14 obl 14:obl:in SpaceAfter=No
17 . . PUNCT . _ 1 punct 1:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0004
# text = Two of them were being run by 2 officials of the Ministry of the Interior!
1 Two two NUM CD NumForm=Word|NumType=Card 6 nsubj:pass 6:nsubj:pass _
2 of of ADP IN _ 3 case 3:case _
3 them they PRON PRP Case=Acc|Number=Plur|Person=3|PronType=Prs 1 nmod 1:nmod:of _
4 were be AUX VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 6 aux 6:aux _
5 being be AUX VBG Tense=Pres|VerbForm=Part 6 aux:pass 6:aux:pass _
6 run run VERB VBN Tense=Past|VerbForm=Part|Voice=Pass 0 root 0:root _
7 by by ADP IN _ 9 case 9:case _
8 2 2 NUM CD NumForm=Digit|NumType=Card 9 nummod 9:nummod _
9 officials official NOUN NNS Number=Plur 6 obl:agent 6:obl:agent _
10 of of ADP IN _ 12 case 12:case _
11 the the DET DT Definite=Def|PronType=Art 12 det 12:det _
12 Ministry Ministry PROPN NNP Number=Sing 9 nmod 9:nmod:of _
13 of of ADP IN _ 15 case 15:case _
14 the the DET DT Definite=Def|PronType=Art 15 det 15:det _
15 Interior Interior PROPN NNP Number=Sing 12 nmod 12:nmod:of SpaceAfter=No
16 ! ! PUNCT . _ 6 punct 6:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0005
# text = The MoI in Iraq is equivalent to the US FBI, so this would be like having J. Edgar Hoover unwittingly employ at a high level members of the Weathermen bombers back in the 1960s.
1 The the DET DT Definite=Def|PronType=Art 2 det 2:det _
2 MoI MoI PROPN NNP Number=Sing 6 nsubj 6:nsubj _
3 in in ADP IN _ 4 case 4:case _
4 Iraq Iraq PROPN NNP Number=Sing 2 nmod 2:nmod:in _
5 is be AUX VBZ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 6 cop 6:cop _
6 equivalent equivalent ADJ JJ Degree=Pos 0 root 0:root _
7 to to ADP IN _ 10 case 10:case _
8 the the DET DT Definite=Def|PronType=Art 10 det 10:det _
9 US US PROPN NNP Number=Sing 10 compound 10:compound _
10 FBI FBI PROPN NNP Number=Sing 6 obl 6:obl:to SpaceAfter=No
11 , , PUNCT , _ 17 punct 17:punct _
12 so so ADV RB _ 17 advmod 17:advmod _
13 this this PRON DT Number=Sing|PronType=Dem 17 nsubj:outer 17:nsubj:outer _
14 would would AUX MD VerbForm=Fin 17 aux 17:aux _
15 be be AUX VB VerbForm=Inf 17 cop 17:cop _
16 like like SCONJ IN _ 17 mark 17:mark _
17 having have VERB VBG Tense=Pres|VerbForm=Part 6 parataxis 6:parataxis _
18 J. J. PROPN NNP Number=Sing 17 obj 17:obj|22:nsubj:xsubj _
19 Edgar Edgar PROPN NNP Number=Sing 18 flat 18:flat _
20 Hoover Hoover PROPN NNP Number=Sing 18 flat 18:flat _
21 unwittingly unwittingly ADV RB _ 22 advmod 22:advmod _
22 employ employ VERB VB VerbForm=Inf 17 xcomp 17:xcomp _
23 at at ADP IN _ 26 case 26:case _
24 a a DET DT Definite=Ind|PronType=Art 26 det 26:det _
25 high high ADJ JJ Degree=Pos 26 amod 26:amod _
26 level level NOUN NN Number=Sing 22 obl 22:obl:at _
27 members member NOUN NNS Number=Plur 22 obj 22:obj _
28 of of ADP IN _ 31 case 31:case _
29 the the DET DT Definite=Def|PronType=Art 31 det 31:det _
30 Weathermen Weathermen PROPN NNPS Number=Plur 31 compound 31:compound _
31 bombers bomber NOUN NNS Number=Plur 27 nmod 27:nmod:of _
32 back back ADV RB _ 35 advmod 35:advmod _
33 in in ADP IN _ 35 case 35:case _
34 the the DET DT Definite=Def|PronType=Art 35 det 35:det _
35 1960s 1960s NOUN NNS Number=Ptan|NumForm=Digit|NumType=Card 22 obl 22:obl:in SpaceAfter=No
36 . . PUNCT . _ 6 punct 6:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0006
# text = The third was being run by the head of an investment firm.
1 The the DET DT Definite=Def|PronType=Art 2 det 2:det _
2 third third ADJ JJ Degree=Pos|NumForm=Word|NumType=Ord 5 nsubj:pass 5:nsubj:pass _
3 was be AUX VBD Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 5 aux 5:aux _
4 being be AUX VBG Tense=Pres|VerbForm=Part 5 aux:pass 5:aux:pass _
5 run run VERB VBN Tense=Past|VerbForm=Part|Voice=Pass 0 root 0:root _
6 by by ADP IN _ 8 case 8:case _
7 the the DET DT Definite=Def|PronType=Art 8 det 8:det _
8 head head NOUN NN Number=Sing 5 obl:agent 5:obl:agent _
9 of of ADP IN _ 12 case 12:case _
10 an a DET DT Definite=Ind|PronType=Art 12 det 12:det _
11 investment investment NOUN NN Number=Sing 12 compound 12:compound _
12 firm firm NOUN NN Number=Sing 8 nmod 8:nmod:of SpaceAfter=No
13 . . PUNCT . _ 5 punct 5:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0007
# text = You wonder if he was manipulating the market with his bombing targets.
1 You you PRON PRP Case=Nom|Person=2|PronType=Prs 2 nsubj 2:nsubj _
2 wonder wonder VERB VBP Mood=Ind|Number=Sing|Person=2|Tense=Pres|VerbForm=Fin 0 root 0:root _
3 if if SCONJ IN _ 6 mark 6:mark _
4 he he PRON PRP Case=Nom|Gender=Masc|Number=Sing|Person=3|PronType=Prs 6 nsubj 6:nsubj _
5 was be AUX VBD Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 6 aux 6:aux _
6 manipulating manipulate VERB VBG Tense=Pres|VerbForm=Part 2 ccomp 2:ccomp _
7 the the DET DT Definite=Def|PronType=Art 8 det 8:det _
8 market market NOUN NN Number=Sing 6 obj 6:obj _
9 with with ADP IN _ 12 case 12:case _
10 his his PRON PRP$ Case=Gen|Gender=Masc|Number=Sing|Person=3|Poss=Yes|PronType=Prs 12 nmod:poss 12:nmod:poss _
11 bombing bombing NOUN NN Number=Sing 12 compound 12:compound _
12 targets target NOUN NNS Number=Plur 6 obl 6:obl:with SpaceAfter=No
13 . . PUNCT . _ 2 punct 2:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0008
# text = The cells were operating in the Ghazaliyah and al-Jihad districts of the capital.
1 The the DET DT Definite=Def|PronType=Art 2 det 2:det _
2 cells cell NOUN NNS Number=Plur 4 nsubj 4:nsubj _
3 were be AUX VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 4 aux 4:aux _
4 operating operate VERB VBG Tense=Pres|VerbForm=Part 0 root 0:root _
5 in in ADP IN _ 12 case 12:case _
6 the the DET DT Definite=Def|PronType=Art 12 det 12:det _
7 Ghazaliyah Ghazaliyah PROPN NNP Number=Sing 12 compound 12:compound _
8 and and CCONJ CC _ 11 cc 11:cc _
9 al al PROPN NNP Number=Sing 11 compound 11:compound SpaceAfter=No
10 - - PUNCT HYPH _ 9 punct 9:punct SpaceAfter=No
11 Jihad Jihad PROPN NNP Number=Sing 7 conj 7:conj:and|12:compound _
12 districts district NOUN NNS Number=Plur 4 obl 4:obl:in _
13 of of ADP IN _ 15 case 15:case _
14 the the DET DT Definite=Def|PronType=Art 15 det 15:det _
15 capital capital NOUN NN Number=Sing 12 nmod 12:nmod:of SpaceAfter=No
16 . . PUNCT . _ 4 punct 4:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0009
# text = Although the announcement was probably made to show progress in identifying and breaking up terror cells, I don't find the news that the Baathists continue to penetrate the Iraqi government very hopeful.
1 Although although SCONJ IN _ 6 mark 6:mark _
2 the the DET DT Definite=Def|PronType=Art 3 det 3:det _
3 announcement announcement NOUN NN Number=Sing 6 nsubj:pass 6:nsubj:pass|8:nsubj:xsubj _
4 was be AUX VBD Mood=Ind|Number=Sing|Person=3|Tense=Past|VerbForm=Fin 6 aux:pass 6:aux:pass _
5 probably probably ADV RB _ 6 advmod 6:advmod _
6 made make VERB VBN Tense=Past|VerbForm=Part|Voice=Pass 21 advcl 21:advcl:although _
7 to to PART TO _ 8 mark 8:mark _
8 show show VERB VB VerbForm=Inf 6 xcomp 6:xcomp _
9 progress progress NOUN NN Number=Sing 8 obj 8:obj _
10 in in SCONJ IN _ 11 mark 11:mark _
11 identifying identify VERB VBG VerbForm=Ger 9 acl 9:acl:in _
12 and and CCONJ CC _ 13 cc 13:cc _
13 breaking break VERB VBG VerbForm=Ger 11 conj 9:acl:in|11:conj:and _
14 up up ADP RP _ 13 compound:prt 13:compound:prt _
15 terror terror NOUN NN Number=Sing 16 compound 16:compound _
16 cells cell NOUN NNS Number=Plur 11 obj 11:obj|13:obj SpaceAfter=No
17 , , PUNCT , _ 6 punct 6:punct _
18 I I PRON PRP Case=Nom|Number=Sing|Person=1|PronType=Prs 21 nsubj 21:nsubj _
19-20 don't _ _ _ _ _ _ _ _
19 do do AUX VBP Mood=Ind|Number=Sing|Person=1|Tense=Pres|VerbForm=Fin 21 aux 21:aux _
20 n't not PART RB _ 21 advmod 21:advmod _
21 find find VERB VB VerbForm=Inf 0 root 0:root _
22 the the DET DT Definite=Def|PronType=Art 23 det 23:det _
23 news news NOUN NN Number=Sing 21 obj 21:obj|34:nsubj:xsubj _
24 that that SCONJ IN _ 27 mark 27:mark _
25 the the DET DT Definite=Def|PronType=Art 26 det 26:det _
26 Baathists Baathist PROPN NNPS Number=Plur 27 nsubj 27:nsubj|29:nsubj:xsubj _
27 continue continue VERB VBP Mood=Ind|Number=Plur|Person=3|Tense=Pres|VerbForm=Fin 23 acl 23:acl:that _
28 to to PART TO _ 29 mark 29:mark _
29 penetrate penetrate VERB VB VerbForm=Inf 27 xcomp 27:xcomp _
30 the the DET DT Definite=Def|PronType=Art 32 det 32:det _
31 Iraqi Iraqi ADJ JJ Degree=Pos 32 amod 32:amod _
32 government government NOUN NN Number=Sing 29 obj 29:obj _
33 very very ADV RB _ 34 advmod 34:advmod _
34 hopeful hopeful ADJ JJ Degree=Pos 21 xcomp 21:xcomp SpaceAfter=No
35 . . PUNCT . _ 21 punct 21:punct _

# sent_id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0010
# text = It reminds me too much of the ARVN officers who were secretly working for the other side in Vietnam.
1 It it PRON PRP Case=Nom|Gender=Neut|Number=Sing|Person=3|PronType=Prs 2 nsubj 2:nsubj _
2 reminds remind VERB VBZ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root 0:root _
3 me I PRON PRP Case=Acc|Number=Sing|Person=1|PronType=Prs 2 iobj 2:iobj _
4 too too ADV RB _ 5 advmod 5:advmod _
5 much much ADV RB _ 2 advmod 2:advmod _
6 of of ADP IN _ 9 case 9:case _
7 the the DET DT Definite=Def|PronType=Art 9 det 9:det _
8 ARVN ARVN PROPN NNP Number=Sing 9 compound 9:compound _
9 officers officer NOUN NNS Number=Plur 2 obl 2:obl:of|13:nsubj _
10 who who PRON WP PronType=Rel 13 nsubj 9:ref _
11 were be AUX VBD Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin 13 aux 13:aux _
12 secretly secretly ADV RB _ 13 advmod 13:advmod _
13 working work VERB VBG Tense=Pres|VerbForm=Part 9 acl:relcl 9:acl:relcl Cxn=rc-wh-nsubj
14 for for ADP IN _ 17 case 17:case _
15 the the DET DT Definite=Def|PronType=Art 17 det 17:det _
16 other other ADJ JJ Degree=Pos 17 amod 17:amod _
17 side side NOUN NN Number=Sing 13 obl 13:obl:for _
18 in in ADP IN _ 19 case 19:case _
19 Vietnam Vietnam PROPN NNP Number=Sing 13 obl 13:obl:in SpaceAfter=No
20 . . PUNCT . _ 2 punct 2:punct _

Loading

0 comments on commit 19bbee7

Please sign in to comment.