nlp

How to test whether a word is in singular form or not in python?

﹥>﹥吖頭↗ 提交于 2021-02-17 19:14:54
问题 I am trying to get whether a word is in singular form or in plural form by using nltk pos_tag. But the results are not accurate. So, I need a way to find how can get whether a word is in singular form or in plural form? moreover I need it without using any python package. 回答1: For English, every word should somehow have a root lemma where the default plurality is singular. Assuming that you have only nouns in your list, you can try this: from nltk.stem import WordNetLemmatizer wnl =

How to test whether a word is in singular form or not in python?

匆匆过客 提交于 2021-02-17 19:14:16
问题 I am trying to get whether a word is in singular form or in plural form by using nltk pos_tag. But the results are not accurate. So, I need a way to find how can get whether a word is in singular form or in plural form? moreover I need it without using any python package. 回答1: For English, every word should somehow have a root lemma where the default plurality is singular. Assuming that you have only nouns in your list, you can try this: from nltk.stem import WordNetLemmatizer wnl =

Turning a sentence from first to second person

十年热恋 提交于 2021-02-17 07:06:40
问题 I'm trying to write a script in Python using nltk which changes a sentence from second person to first person. Example: the sentence I went to see Avatar and you came with me should become You went to see Avatar and I came with you Is there a built-in function in nltk that does this? 回答1: There shouldn't be too many forms of personal and possessive pronouns in English. If you create a dictionary of correspondence between 1st and 2nd person forms, you can then tokenize the original sentence

Turning a sentence from first to second person

故事扮演 提交于 2021-02-17 07:06:09
问题 I'm trying to write a script in Python using nltk which changes a sentence from second person to first person. Example: the sentence I went to see Avatar and you came with me should become You went to see Avatar and I came with you Is there a built-in function in nltk that does this? 回答1: There shouldn't be too many forms of personal and possessive pronouns in English. If you create a dictionary of correspondence between 1st and 2nd person forms, you can then tokenize the original sentence

pip install pyemd error?

旧城冷巷雨未停 提交于 2021-02-17 06:17:06
问题 I'm trying to install pyemd package in Python through pip and getting following error: C:\Users\dipanwita.neogy>pip install pyemd Collecting pyemd Using cached pyemd-0.4.3.tar.gz Requirement already satisfied: numpy<2.0.0,>=1.9.0 in c:\users\dipanwita.neogy\a naconda3\lib\site-packages (from pyemd) Building wheels for collected packages: pyemd Running setup.py bdist_wheel for pyemd ... error Complete output from command C:\Users\dipanwita.neogy\Anaconda3\python.exe -u -c "import setuptools,

How to add punctuation marks for the sentences?

試著忘記壹切 提交于 2021-02-16 15:39:06
问题 How to approach the problem of building a Punctuation Predictor? The working demo for the question can be found in this link. Input Text is as below: "its been a little while Kirk tells me its actually been three weeks now that Ive been using this device right here that is of course the Galaxy S ten I mean Ive just been living with this phone this has been my phone has the SIM card in it I took photos I lived live I sent tweets whatsapp slack email whatever other app this was my smart phone"

with NLTK, How can I generate different form of word, when a certain word is given?

别来无恙 提交于 2021-02-16 14:39:06
问题 For example, Suppose the word "happy" is given, I want to generate other forms of happy such as happiness, happily... etc. I have read some other previous questions on Stackoverflow and NLTK references. However, there are only POS tagging, morph just like identifying the grammatical form of certain words within sentences, not generating a list of different words. Is there anyone who bumped into similar issues? Thank you. 回答1: This type of information is included in the Lemma class of NLTK's

How to remove stop phrases/stop ngrams (multi-word strings) using pandas/sklearn?

独自空忆成欢 提交于 2021-02-16 09:14:31
问题 I want to prevent certain phrases for creeping into my models. For example, I want to prevent 'red roses' from entering into my analysis. I understand how to add individual stop words as given in Adding words to scikit-learn's CountVectorizer's stop list by doing so: from sklearn.feature_extraction import text additional_stop_words=['red','roses'] However, this also results in other ngrams like 'red tulips' or 'blue roses' not being detected. I am building a TfidfVectorizer as part of my

How to remove stop phrases/stop ngrams (multi-word strings) using pandas/sklearn?

亡梦爱人 提交于 2021-02-16 09:14:22
问题 I want to prevent certain phrases for creeping into my models. For example, I want to prevent 'red roses' from entering into my analysis. I understand how to add individual stop words as given in Adding words to scikit-learn's CountVectorizer's stop list by doing so: from sklearn.feature_extraction import text additional_stop_words=['red','roses'] However, this also results in other ngrams like 'red tulips' or 'blue roses' not being detected. I am building a TfidfVectorizer as part of my

How to remove stop phrases/stop ngrams (multi-word strings) using pandas/sklearn?

风格不统一 提交于 2021-02-16 09:14:06
问题 I want to prevent certain phrases for creeping into my models. For example, I want to prevent 'red roses' from entering into my analysis. I understand how to add individual stop words as given in Adding words to scikit-learn's CountVectorizer's stop list by doing so: from sklearn.feature_extraction import text additional_stop_words=['red','roses'] However, this also results in other ngrams like 'red tulips' or 'blue roses' not being detected. I am building a TfidfVectorizer as part of my