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

HiddenMarkovModelTrainer train_unsupervised - TypeError #1859

Open
ireland-samantha opened this issue Oct 14, 2017 · 3 comments
Open

HiddenMarkovModelTrainer train_unsupervised - TypeError #1859

ireland-samantha opened this issue Oct 14, 2017 · 3 comments

Comments

@ireland-samantha
Copy link

ireland-samantha commented Oct 14, 2017

Hello,

I'm trying to use the train_unsupervised method from the nltk.hmm module, however, it's throwing the following TypeError:
TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max

Here is the code I'm using:

import nltk

trainer = nltk.hmm.HiddenMarkovModelTrainer()
tagger = trainer.train_unsupervised([
    ('a', ''),
    ('b', ''),
    ('c', '')
])

Here's the full error:
Traceback (most recent call last): File "test.py", line 10, in <module> ('c', '') File "/Library/Python/2.7/site-packages/nltk/tag/hmm.py", line 932, in train_unsupervised priors = RandomProbDist(self._states) TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max

NLTK version 3.2.5; tested on Python 2.7.10 and Python 2.7.14.

Am I doing something silly wrong?

Thank you very much.

@ireland-samantha ireland-samantha changed the title nltk.hmm.HiddenMarkovModelTrainer train_unsupervised - TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max HiddenMarkovModelTrainer train_unsupervised - TypeError Oct 14, 2017
@campionfellin
Copy link
Contributor

This also happens using python 3.6.2 with NLTK 3.2.5

PavanGJ added a commit to PavanGJ/nltk that referenced this issue Oct 25, 2017
stevenbird added a commit that referenced this issue Nov 2, 2017
…vModelTrainer

Issue #1859: TypeError in HiddenMarkovModelTrainer train_unsupervised
alvations pushed a commit that referenced this issue Dec 6, 2017
@radhen
Copy link

radhen commented Apr 21, 2018

I am following up on issue #1873. I was getting the error
TypeError: Can't instantiate abstract class RandomProbDist with abstract methods max

with NLTK version 3.2.4. I saw the commit to fix this issue was in version 3.2.5 so I downloaded that but I still get the same error. Any ideas why?

@PavanGJ
Copy link
Contributor

PavanGJ commented May 22, 2018

The updates in the git repo aren't yet reflected in the nltk pip package. I would suggest pulling the updates in the commits and working with it.

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

No branches or pull requests

5 participants