M
M
Mikhail2017-09-07 20:57:06
Python
Mikhail, 2017-09-07 20:57:06

Error when working with the naiveBayesClassifier library, how to solve the problem ImportError: No module named 'ExceptionNotSeen?

Hello everyone, now I'm trying to figure out the naiveBayesClassifier library and trying it on an example from Github here .
So here is the actual code:

from naiveBayesClassifier import tokenizer
from naiveBayesClassifier.trainer import Trainer
from naiveBayesClassifier.classifier import Classifier

newsTrainer = Trainer(tokenizer)

newsSet =[
    {'text': 'not to eat too much is not enough to lose weight', 'category': 'health'},
    {'text': 'Russia try to invade Ukraine', 'category': 'politics'},
    {'text': 'do not neglect exercise', 'category': 'health'},
    {'text': 'Syria is the main issue, Obama says', 'category': 'politics'},
    {'text': 'eat to lose weight', 'category': 'health'},
    {'text': 'you should not eat much', 'category': 'health'}
]
for news in newsSet:
    newsTrainer.train(news['text'], news['category'])

newsClassifier = Classifier(newsTrainer.data, tokenizer)

classification = newsClassifier.classify("Obama is")

print(classification)

I imported the library, did what was necessary. I googled the error "ImportError: No module named 'ExceptionNotSeen'", but it did not lead to a significant shift.
Traceback (most recent call last):
File "/Users/YouTube/PycharmProjects/neturalnetw/naive.py", line 7, in
from naiveBayesClassifier.trainer import Trainer
File "/Library/Frameworks/Python.framework/Versions/3.5/lib /python3.5/site-packages/naiveBayesClassifier/trainer.py", line 1, in
from naiveBayesClassifier.trainedData import TrainedData
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages /naiveBayesClassifier/trainedData.py", line 1, in
from ExceptionNotSeen import NotSeen
ImportError: No module named 'ExceptionNotSeen'

I assume that the problem is directly in the installed from naiveBayesClassifier library, but I still can’t solve it. I would be very happy to help you with this issue.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question