We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The sentence is just splited by character.
# 导入spacy并创建中文nlp对象 import spacy nlp = spacy.blank("zh") # 处理文本 doc = nlp("我喜欢老虎和狮子。") # 遍历打印doc中的内容 for i, token in enumerate(doc): print(i, token.text) # 截取Doc中"老虎"的部分 laohu = doc[2:3] print(laohu.text) # 截取Doc中"老虎和狮子"的部分(不包括"。") laohu_he_shizi = doc[2:5] print(laohu_he_shizi.text)
Output
0 我 1 喜 2 欢 3 老 4 虎 5 和 6 狮 7 子 8 。 欢 欢老虎
The text was updated successfully, but these errors were encountered:
Thanks for the note, we should update this to use jieba, I suspect.
jieba
Sorry, something went wrong.
No branches or pull requests
The sentence is just splited by character.
Output
The text was updated successfully, but these errors were encountered: