Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: ngrams() got an unexpected keyword argument 'pad_symbol' #1

Open
kindraywind opened this issue Oct 14, 2016 · 1 comment

Comments

@kindraywind
Copy link

Environment:
Python 3.5.2
nltk 3.2.1

reproduce step:
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'
@zotroneneis
Copy link

zotroneneis commented Oct 30, 2017

Change it to (right_pad_symbol='</s>', left_pad_symbol='<s>')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants