我正在尝试通过文本创建单词语料库。我使用空间。所以有我的代码:
import spacy
nlp = spacy.load('fr_core_news_md')
f = open("text.txt")
doc = nlp(''.join(ch for ch in f.read() if ch.isalnum() or ch == " "))
f.close()
del f
words = []
for token in doc:
if token.lemma_ not in words:
words.append(token.lemma_)
f = open("corpus.txt", 'w')
f.write("Number of words:" + str(len(words)) + "\n" + ''.join([i + "\n" for i in sorted(words)]))
f.close()
Run Code Online (Sandbox Code Playgroud)
但它返回这个异常:
ValueError: [E088] Text of length 1027203 exceeds maximum of 1000000. The v2.x parser and NER models require roughly 1GB of …Run Code Online (Sandbox Code Playgroud) 我使用ListAdapter来显示ListView中的数据.
如何从代码中选择ListView中的项目?