Open kindraywind opened 7 years ago
Environment: Python 3.5.2 nltk 3.2.1
reproduce step: python3 example.py
python3 example.py
error message:
Traceback (most recent call last): File "example.py", line 8, in <module> lm = KneserNeyLM(3, gut_ngrams, end_pad_symbol='<s>') File "/Users/username/kneser-ney/kneser_ney.py", line 24, in __init__ self.lm = self.train(ngrams) File "/Users/username/kneser-ney/kneser_ney.py", line 33, in train kgram_counts = self._calc_adj_counts(Counter(ngrams)) File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/collections/__init__.py", line 530, in __init__ self.update(*args, **kwds) File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/collections/__init__.py", line 617, in update _count_elements(self, iterable) File "example.py", line 7, in <genexpr> pad_left=True, pad_right=True, pad_symbol='<s>')) TypeError: ngrams() got an unexpected keyword argument 'pad_symbol'
Change it to (right_pad_symbol='</s>', left_pad_symbol='<s>')
(right_pad_symbol='</s>', left_pad_symbol='<s>')
Environment: Python 3.5.2 nltk 3.2.1
reproduce step:
python3 example.py
error message: