nlp - NLP:哪些是与动词相关的依赖标签?
问题描述
我需要识别与动词相关的所有依赖标签。到目前为止,我已经确定:
'根'
'xcomp'
spacy.explain('xcomp') Out[72]: 'open clausal complement'
- '辅助'
spacy.explain('aux') Out[73]: 'auxiliary'
还有其他人吗?
解决方案
我使用 NLTK 网络文本语料库来获取词性是动词的依赖标记的计数。
from collections import Counter
from nltk.corpus import webtext
import spacy
nlp = spacy.load('en_core_web_lg')
nlp.max_length = 10**50
doc = nlp(webtext.raw())
print(Counter([tok.dep_ for tok in doc if tok.pos_=='VERB']))
输出:
Counter({'ROOT': 18067, 'aux': 4649, 'advcl': 4159, 'xcomp': 3102, 'ccomp': 3094, 'conj': 2568, 'acl': 1395, 'relcl': 1311, 'amod': 1073, 'pcomp': 1059, 'parataxis': 594, 'compound': 519, 'csubj': 458, 'nsubj': 248, 'dobj': 237, 'dep': 187, 'pobj': 174, 'intj': 157, 'auxpass': 148, 'nmod': 131, 'appos': 119, 'acomp': 119, 'prep': 63, 'attr': 46, 'npadvmod': 40, 'nsubjpass': 24, 'advmod': 21, 'oprd': 17, 'punct': 14, 'poss': 8, 'csubjpass': 6, 'nummod': 4, 'cc': 3, 'preconj': 2, 'mark': 1, 'meta': 1})
推荐阅读
- node.js - 从 nodejs azure web-app 记录标准输出/错误:仍然不支持 Blob?
- javascript - 页面上未显示 Ajax 响应
- c - 从 GNU AS 调用时,C 乘法结果放在哪里?
- python - 如何在 SQLAlchemy 和 Firebird 的自定义查询中将 Python 列表绑定为参数?
- php - 将提交的表单值保存为 cookie
- java - 升级 Eclipse 时快速远程重新安装所需的插件
- authentication - WSO2 APIM 身份在 SAML SSO 响应的 NameID 中回复用户名或域/用户名
- angular - 如何在 ionic4 应用程序中使用原生谷歌地图?
- .net - 查找大数组的声明
- facebook-graph-api - Instagram:无法通过 ID 获取标记的媒体对象