Using windows 10
I've install textblob using "py -m pip install textblob".
I can import textblob, or from textblob import blob,word
But i cant: from textblobl import Textblob.
The error i get is:
Traceback (most recent call last):
File "", line 1, in
from textblob import Textblob
ImportError: cannot import name 'Textblob'
Thanks.
You can try whit this:
from textblob import TextBlob
you can try change your file name TextBlob.py
Related
I want to import gtts. I wrote "import gtts" But it shows me a failure because he didn't know gTTS. I've already installed gtts with "pip install gtts" but it still didn't work. Please help.
Thanks
error:
PS C:\Users\dealt> & C:/Users/dealt/AppData/Local/Programs/Python/Python311/python.exe
{file}
Traceback (most recent call last):
File "c:\Users\dealt\Desktop\Durchsage.py", line 1, in <module>
import gtts
ModuleNotFoundError: No module named 'gtts'
I am trying to import gTTS
I was trying to use PunktWordTokenizer and it was occurred an error as below.
from nltk.tokenize.punkt import PunktWordTokenizer
And this gave the following error message.
Traceback (most recent call last): File "file", line 5, in <module>
from nltk.tokenize.punkt import PunktWordTokenizer ImportError: cannot import name PunktWordTokenizer
I've checked that nltk is installed and that PunkWordTokenzer is also installed using nltk.download(). Need some help for this.
PunktWordTokenizer was previously exposed to user but not any more. You can rather use WordPunctTokenizer.
from nltk.tokenize import WordPunctTokenizer
WordPunctTokenizer().tokenize(“text to tokenize”)
The difference is :
PunktWordTokenizer splits on punctuation, but keeps it with the word. Where as WordPunctTokenizer splits all punctuations into separate tokens.
For example, given Input: This’s a test
PunktWordTokenizer: [‘This’, “‘s”, ‘a’, ‘test’]
WordPunctTokenizer: [‘This’, “‘”, ‘s’, ‘a’, ‘test’]
There appears to be a regression related to PunktWordTokenizer in 3.0.2. The issue was not present in 3.0.1, rolling back to that version or earlier fixes the issue.
>>> import nltk
>>> nltk.__version__
'3.0.2'
>>> from nltk.tokenize import PunktWordTokenizer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name PunktWordTokenizer
For solving this Try pip install -U nltk to upgrade your NLTK version.
I am using Python 2.7.10 and have installed scikit-0.15.2 using pip and i already have "numpy-1.1.10" and "scipy-0.16.0" installed and it works fine but when i try to import TfidfVectorizer from sklearn to construct a term document matrix with tf-idf values
from sklearn.feature_extraction.text import TfidfVectorizer
i get an error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import sklearn
File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 37, in <module>
from . import __check_build
ImportError: cannot import name __check_build
I have already gone through the earlier post and tried the solutions but it didn't work.
For windows user try to install numpy+mkl package from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn
and after successful installation restart the python
Had the same problem. installing scipy solved the problem for me.
Try...
#sudo pip install scipy
What does it say if you fire up a python prompt and type
import scipy
also there might be some pointers in this thread ImportError in importing from sklearn: cannot import name check_build
I was trying to use nltk for python and then confronted with this problem.
>>>from nltk.corpus import sinica_tree
and then the error occured:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name sinica_tree
I've checked that nltk is installed and that sinica_tree is also installed using nltk.download(). Need some help for this.
According to the documentation it looks like it should be:
from nltk.corpus import sinica_treebank
See: http://www.nltk.org/nltk_data/
>>>import nltk
>>>nltk.download()
---------------------------------------------------------------------------
d) Download l) List u) Update c) Config h) Help q) Quit
---------------------------------------------------------------------------
Downloader> d
Download which package (l=list; x=cancel)?
Identifier> treebank
then try to import
from nltk.corpus import sinica_treebank
I have to use framenet in nltk.corpus. So, I downloaded that corpus by using the nltk.download(). And the framenet directory is now C:\nltk_data\corpora\framenet_v15...
But when I import that framenet, I can't. I can't find the reason.
I want to some works as explained in here; http://nltk.org/howto/framenet.html
>>> import nltk.corpus.framenet
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import nltk.corpus.framenet
ImportError: No module named framenet
Please, help me. Thanks.
In your link it import as so:
from nltk.corpus import framenet
Have you tried that?
EDIT: Version 3.0 and above of NLTK has framenet in the nltk.corpus.reader package, so it should be:
from nltk.corpus.reader import framenet