我正在尝试用 spacy 进行标记化。我是 python 新手,我想知道如何对 csv 文件进行标记化。
T 在 Jupyter notebook 中打开了文件:
import csv
import wheel
with open('/Users/Desktop/Python Path copia/samsungs10.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=';')
for riga in csv_reader:
for campo in riga:
print(campo, end=" ")
print("") #fine riga
doc = nlp ('csv_file')
并且输出正确地是 csv 数据集。
试图标记我有这个问题:
#python3 -m spacy download en_core_web_sm
import spacy
import en_core_web_sm
for token in doc:
print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
token.shape_, token.is_alpha, token.is_stop)
输出是:
csv_file csv_file ADP IN ROOT xxx_xxxx False False.
为什么?