我試圖從古蘭經聖書中解讀一些詞,但有些詞不能詞法化。 這裏是我的一句話: sentence = "Then bring ten surahs like it that have been invented and call upon for assistance whomever you can besides Allah if you should be truthful"
那句話是我的tx
我得到以下錯誤。 if form in exceptions: TypeError: unhashable type: 'list'
以下是我的代碼。 from nltk.tokenize import word_tokenize
from nltk.stem.wordnet import WordNetLemmatizer
sentence = 'missed you'
w_toke
我有一個包含句子的列表。 list = ["I'm hoping to go jogging", "I haven't eaten in a while","where is everybody going"] 我想lemmatize上面的列表,並與引理的替代原話。 我該如何使用spacy? 我知道我可以在一個循環中打印引理,但我想要的是用詞性化替換原始單詞。
PostgreSQL的to_tsvector函數是非常有用的,但對於我的數據集,它比我想要的要多一點。 例如: select *
from to_tsvector('english', 'This is my favourite game. I enjoy everything about it.');
生產:'enjoy':7 'everyth':8 'favourit':4 'game'
我正在嘗試使用lemmatizer預處理一個字符串,然後刪除標點符號和數字。我正在使用下面的代碼來執行此操作。我沒有收到任何錯誤,但文本沒有被適當地預處理。只有停用詞被刪除,但詞彙化不起作用,標點和數字也保留。 from nltk.stem import WordNetLemmatizer
import string
import nltk
tweets = "This is a beaut