Skip to content

Natural language processing tools (tokenizer, ...) and evaluation metrics (BLUE, ...) for morphologically complex languages such as those of Africa.

License

Notifications You must be signed in to change notification settings

Tikquuss/nlp_tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pip install -r requirements.txt

BLEU evaluation

python bleu.py --ref my/ref.txt --hyp my/hyp.txt --max_order 4 --smooth False
import os, subprocess

ref = "my/ref.txt" 
hyp = "my/hyp.txt"

command = "multi-bleu.perl %s < %s"
if os.name == "nt" :
    command = "perl %s" % command
p = subprocess.Popen(command % (ref, hyp), stdout=subprocess.PIPE, shell=True)
result = p.communicate()[0].decode("utf-8")
if result.startswith('BLEU'):
    bleu = float(result[7:result.index(',')])
else:
    print('Impossible to parse BLEU score! "%s"' % result)        
    bleu = -1

About

Natural language processing tools (tokenizer, ...) and evaluation metrics (BLUE, ...) for morphologically complex languages such as those of Africa.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published