Skip to content

UnicodeEncodeError from edlib when evaluating

@Chaza_Abdelwahab encountered the following error when running nerval.

Traceback (most recent call last):
  File "edlib.pyx", line 32, in edlib._map_to_bytes
  File "edlib.pyx", line 19, in edlib._map_ascii_string
edlib.NeedsAlphabetMapping

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/users/cabdelwahab/git_repos/ner-training/.env/bin/nerval", line 8, in <module>
    sys.exit(main())
  File "/home/users/cabdelwahab/git_repos/ner-training/.env/lib/python3.8/site-packages/nerval/evaluate.py", line 677, in main
    run(args.annot, args.predict, args.threshold, args.verbose)
  File "/home/users/cabdelwahab/git_repos/ner-training/.env/lib/python3.8/site-packages/nerval/evaluate.py", line 525, in run
    align_result = edlib.align(annot["words"], predict["words"], task="path")
  File "edlib.pyx", line 95, in edlib.align
  File "edlib.pyx", line 48, in edlib._map_to_bytes
  File "edlib.pyx", line 47, in edlib._map_to_bytes.lambda
UnicodeEncodeError: 'ascii' codec can't encode character '\x9a' in position 2: ordinal not in range(128)

This is an error solved in the latest version of edlib per https://github.com/Martinsos/edlib/issues/184.