Open ForeverZyh opened 7 years ago
seems there is something wrong with the install import or python path in system variable.
Solve it this way
It solved that issue for me.
Thks!
Does not work in virtual environment (anaconda) Still getting thrown the same error Naive Bayes Classifier has the ExceptionNotFound in its folder Tried storing the file locally in the project directory but it's not working
you need to import class NotSeen into all dependent class files. Add from ExceptionNotSeen import NotSeen in all relevent files under C:\Users\Username\AppData\Local\Programs\Python\Python36\Lib\site-packages\naiveBayesClassifier
I did that to
It should solve your issue
All files already make this import
whats the error message you are getting ? post it here
I am getting the following error with Anaconda:
Traceback (most recent call last):
File "cat.py", line 6, in <module>
from naiveBayesClassifier.trainer import Trainer
File "C:\Users\username\AppData\Local\Continuum\Anaconda3\lib\site-packages\naiveBayesClassifier\trainer.py", line 1, in <module>
from naiveBayesClassifier.trainedData import TrainedData
File "C:\Users\username\AppData\Local\Continuum\Anaconda3\lib\site-packages\naiveBayesClassifier\trainedData.py", line 1, in <module>
from ExceptionNotSeen import NotSeen
ModuleNotFoundError: No module named 'ExceptionNotSeen'
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-29-cd130a80dcb6> in <module>()
10 import textacy
11 import textacy.datasets
---> 12 from genderizer.genderizer import Genderizer
13 get_ipython().run_line_magic('matplotlib', 'inline')
~/anaconda3/envs/nlp/lib/python3.6/site-packages/genderizer/genderizer.py in <module>()
4
5 from naiveBayesClassifier import tokenizer
----> 6 from naiveBayesClassifier.trainer import Trainer
7 from naiveBayesClassifier.classifier import Classifier
8
~/anaconda3/envs/nlp/lib/python3.6/site-packages/naiveBayesClassifier/trainer.py in <module>()
----> 1 from naiveBayesClassifier.trainedData import TrainedData
2
3 class Trainer(object):
4
5 """docstring for Trainer"""
~/anaconda3/envs/nlp/lib/python3.6/site-packages/naiveBayesClassifier/trainedData.py in <module>()
----> 1 from ExceptionNotSeen import NotSeen
2
3 class TrainedData(object):
4 def __init__(self):
5 self.docCountOfClasses = {}
ModuleNotFoundError: No module named 'ExceptionNotSeen'
Not sure about anaconda or virtual environment.
I would cross check for ExceptionNotSeen.py file in C:\Users\username\AppData\Local\Continuum\Anaconda3\lib\site-packages\naiveBayesClassifier directory.
Also check whether ExceptionNotSeen.py has been define as below
class NotSeen(Exception):
"""
Exception for tokens which are not indexed
because never seen in the trainin data
"""
def __init__(self, value):
self.value = value
def __str__(self):
return "Token '{}' is never seen in the training set.".format(self.value)
And
Add from ExceptionNotSeen import NotSeen in all relevent files classifier.py , trainedData.py in same directory too.
i got the same error.
C:\Users\user\Desktop\amazonscrapy-master\AmazonScrapy\spiders>python amazon_spider.py
Traceback (most recent call last):
File "amazon_spider.py", line 13, in
Is the version of python that many of you are using is 3.x? If so, download 2to3, copy 2to3 file to dir of genderizer package, then open the terminal in genderizer package dir and run the following command:
2to3 -w .
which converts all the python files to the version 3. This should solve all the above problems and this has worked for me!
the same error。。。。
seems there is something wrong with the install import or python path in system variable.
Solve it this way
It solved that issue for me.
I don't have this file(.py)
You can try this " from naiveBayesClassifier.ExceptionNotSeen import NotSeen " it worked for me in all required files
Maybe something is missing...
Traceback (most recent call last): File "/Users/ZhangYuhao/Documents/Datamining/project/Q_number.py", line 3, 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'
Could anyone help me out?