python - 将 [spacy list of pos_] 转换为 [list of tag_ ]
问题描述
['VERB', 'NOUN', 'ADP', 'NOUN', 'CCONJ', 'NOUN', 'PUNCT']
#how to convert this list to this :
['VBG', 'NNS', 'IN', 'NNS', 'CC', 'NN', '.']
** 我已经使用 spacy pos_ 编写了代码,但现在我的输入已更改为 tag_ **
解决方案
data = ['VERB', 'NOUN', 'ADP', 'NOUN', 'CCONJ', 'NOUN', 'PUNCT']
lookup = {
'ADP': 'IN',
'CCONJ': 'CC',
'NOUN': 'NNS',
'NOUN': 'NN',
'PUNCT': '.',
'VERB': 'VBG'
}
result = [ lookup[w] for w in data ]
推荐阅读
- android - 你能从房间数据库中返回单个字符串数据吗?
- android - how to make buttons align at the middle? android studio
- reactjs - 刷新显示内容的页面后重定向显示空内容后的 React Web 应用程序
- c# - 如何枚举64位进程的所有模块?
- python - Finding similar looking items from a dataframe using python
- c# - 在 C# 中的 EWS 中保存内联附件
- java - I am trying to take to char inputs from a single string using Scanner with .charAt()
- sql - How to increment with limited value
- image - 无法将 docker 图像推送到我的 docker hub 帐户中
- javascript - Why we do extends React.Component when creating the class component in React?