I tried to work with OpenKiwi to Anaconda3 and after installation (pip install openkiwi) I execute following code (I do this because I want to create openkiwi vocabulary) :
import warnings
from collections import defaultdict
import torchtext
from kiwi.constants import PAD, START, STOP, UNALIGNED, UNK, UNK_ID
And than I have an error message:
ImportError Traceback (most recent call last)
<ipython-input-6-ea850b280bef> in <module>
4 import torchtext
5
----> 6 from kiwi.constants import PAD, START, STOP, UNALIGNED, UNK, UNK_ID
ImportError: cannot import name 'UNK_ID' from 'kiwi.constants' (C:\Users\Mike\anaconda3\lib\site-packages\kiwi\constants.py)
Anaconda3 has following versions: >!
UNK_ID
is no longer a constant in the latest version of OpenKiwi. That second link shows some code targeting version 1.4 or so, while OpenKiwi is at version 2.1 now. Just drop the UNK_ID
from the import
line, and replace the one in the code with 0
.