hplt-project / sacremoses

Python port of Moses tokenizer, truecaser and normalizer
MIT License
486 stars 59 forks source link

detrucase Error: unsupported operand type(s) #106

Open colingair opened 4 years ago

colingair commented 4 years ago

use_known=True gives error Look at the followings:

mtr = MosesTruecaser("mymodel_x") mtr.truecase("THE ADVENTURES OF SHERLOCK HOLMES") ['the', 'adventures', 'OF', 'Sherlock', 'HOLMES'] mtr.truecase("THE ADVENTURES OF SHERLOCK HOLMES", return_str=True) 'the adventures OF Sherlock HOLMES' mtr.truecase("THE ADVENTURES OF SHERLOCK HOLMES", return_str=True, use_known=True) Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sacremoses/truecase.py", line 306, in truecase token = token + other_factors TypeError: unsupported operand type(s) for +: 'int' and 'str' mdtr.detruecase("the adventures OF Sherlock HOLMES", return_str=True) 'The adventures OF Sherlock HOLMES'