nltk

Problem to extract NER subject + verb with spacy and Matcher

Problem to extract NER subject + verb with spacy and Matcher Question: I work on an NLP project and i have to use spacy and spacy Matcher to extract all named entities who are nsubj (subjects) and the verb to which it relates : the governor verb of my NE nsubj. Example : Georges and …

Total answers: 1

Unable to import process_tweets from utils

Unable to import process_tweets from utils Question: Thanks for looking into this, I have a python program for which I need to have process_tweet and build_freqs for some NLP task, nltk is installed already and utils wasn’t so I installed it via pip install utils but the above mentioned two modules apparently weren’t installed, the …

Total answers: 5

is there a way to check similarity between two full sentences in python?

is there a way to check similarity between two full sentences in python? Question: I am making a project like this one here: https://www.youtube.com/watch?v=dovB8uSUUXE&feature=youtu.be but i am facing trouble because i need to check the similarity between the sentences for example: if the user said: ‘the person wear red T-shirt’ instead of ‘the boy wear …

Total answers: 2

gerund form of a word in python

gerund form of a word in python Question: I’d like to get the gerund form of a string. I have not found a straightforward way to invoke a library to get the gerund. I applied the rules for words ending in ‘ing`, but because I am getting some errors due to exceptions. Then, I am …

Total answers: 1

Python Sentiment Analysis given a dataset with Facebook Posts

Python Sentiment Analysis given a dataset with Facebook Posts Question: I have a dataset containing raw facebook posts and comments. What I would like to do is to perform sentiment analysis with Python 3 (NTLK ?) in order to label each post and each comment against some categories (a sort of clustering in unsupervised mode). …

Total answers: 2

NLP Stemming and Lemmatization using Regular expression tokenization

NLP Stemming and Lemmatization using Regular expression tokenization Question: Define a function called performStemAndLemma, which takes a parameter. The first parameter, textcontent, is a string. The function definition code stub is given in the editor. Perform the following specified tasks: 1.Tokenize all the words given in textcontent. The word should contain alphabets or numbers or …

Total answers: 6

Get inertia for nltk k means clustering using cosine_similarity

Get inertia for nltk k means clustering using cosine_similarity Question: I have used nltk for k mean clustering as I would like to change the distance metric. Does nltk k means have an inertia similar to that of sklearn? Can’t seem to find in their documentation or online… The code below is how people usually …

Total answers: 3

Why I am getting RuntimeError: generator raised StopIteration? and how to solve it?

Why I am getting RuntimeError: generator raised StopIteration? and how to solve it? Question: I am making Bigrams of the tokens stored in list docToken. print(docToken[520]) Output: [‘sleepy’, ‘account’, ‘just’, ‘man’, ‘tired’, ‘twitter’, ‘case’, ‘romney’, ‘candidate’, ‘looks’] list(nltk.bigrams(docToken[520])) Output: [(‘sleepy’, ‘account’), (‘account’, ‘just’), (‘just’, ‘man’), (‘man’, ‘tired’), (‘tired’, ‘twitter’), (‘twitter’, ‘case’), (‘case’, ‘romney’), (‘romney’, ‘candidate’), …

Total answers: 5

NLTK ImportError: DLL load failed: The specified module could not be found

NLTK ImportError: DLL load failed: The specified module could not be found Question: I am trying to import nltk to my project. I have tried installing it through many different ways and they all lead to the same outcome. I tried installing it through the lightbulb on PyCharm, I tried installing the module through the …

Total answers: 7

Removing nonsense words in python

Removing nonsense words in python Question: I want to remove nonsense words in my dataset. I tried which I saw StackOverflow something like this: import nltk words = set(nltk.corpus.words.words()) sent = “Io andiamo to the beach with my amico.” ” “.join(w for w in nltk.wordpunct_tokenize(sent) if w.lower() in words or not w.isalpha()) But now since …

Total answers: 2