Skip to content
Snippets Groups Projects
Commit b522742d authored by piotrmp's avatar piotrmp
Browse files

Tweaks in the evaluation script.

parent 0580d103
No related branches found
No related tags found
No related merge requests found
"""
Evaluation of available model by comparing to UD gold standard
Evaluation of available models by comparing to UD gold standard
"""
from pathlib import Path
......@@ -10,8 +10,8 @@ from lambo.segmenter.lambo import Lambo
from lambo.segmenter.spacy import Spacy_segmenter
if __name__ == '__main__':
modelpath = Path.home() / 'PATH-TO/models/vanilla/'
modelPpath = Path.home() / 'PATH-TO/models/full'
modelpath = Path.home() / 'PATH-TO/models/full211-s/'
modelPpath = Path.home() / 'PATH-TO/models/full213-withunk/'
tmp_path = Path.home() / 'PATH-TO/out/tmp.conllu'
treebanks = [line.split(' ')[0] for line in
......@@ -22,19 +22,19 @@ if __name__ == '__main__':
# Load spaCy segmenter as baseline
spacy = Spacy_segmenter()
segmenters = {'spaCy': spacy, 'LAMBO': None, 'LAMBO pretrained': None}
segmenters = {'spaCy': spacy, 'LAMBO': None, 'LAMBO modified': None}
print('Treebank\tMeasure (F1)\t' + '\t'.join(segmenters))
for treebank in treebanks:
# Load LAMBO segmenter
lambo = Lambo.from_path(modelpath, treebank)
# Load pretrained LAMBO segmenter
# Load modified LAMBO segmenter
lamboP = Lambo.from_path(modelPpath, treebank)
segmenters['LAMBO'] = lambo
segmenters['LAMBO pretrained'] = lamboP
segmenters['LAMBO modified'] = lamboP
data_path = Path.home() / 'data' / 'lambo' / 'ud-treebanks-v2.9' / treebank
data_path = Path.home() / 'data' / 'lambo' / 'ud-treebanks-v2.11' / treebank
text_file = list(data_path.glob('*-ud-test.txt'))
if len(text_file) != 1:
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment