Missing Natural Language Processing modules in VSCode

Hi everyone!
I’m pretty new to coding and after taking a Learn Python 3 course, I wanted to learn something about Natural Language Processing using Python. To play around a bit without having to use the code editor on the Codecademy website and also to get used to different programmes, I downloaded Visual Studio Code and I like it a lot. But for some reason, trying to execute this piece of code is giving me some weird errors that I’m not getting on the codecademy website:

#nltk preprocessing magic
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer

#grabbing a part of speech function:
from part_of_speech import get_part_of_speech

First I got this error: “ModuleNotFoundError: No module named ‘nltk’” and I was able to resolve that by just using “pip3 install --user nltk”. But now I’m getting the same error for the ‘part_of_speech’ module and trying to install that using pip3 is giving me these error messages “ERROR: Could not find a version that satisfies the requirement part_of_speech (from versions: none)
ERROR: No matching distribution found for part_of_speech”

This might not be the right place for my question but I’m just hoping someone reads this and finds the answer so blatantly obvious that they’ll have mercy and explain to me what I can do to fix this. I’d really appreciate it because I have no idea what else to do.

Hello!

The part_of_speech module is not an external module, so you cannot install it with pip. This is a local module from the CodeCademy project. So you can just copy its contents from the CodeCademy tutorial.

In the CodeCademy tutorial, find the folder icon in the code editor and then click part_of_speech.py. Create a file of the same name in your local project and copy the code from CodeCademy into it.

2 Likes

Thanks so much! This worked like a charm :star_struck: