【问题标题】:Get extended spaCy morphological information获取扩展的 spaCy 形态信息
【发布时间】:2018-12-19 11:05:05
【问题描述】:

我希望将 spaCy 用于我的研究,形态学信息对我来说很重要。

阅读the documentation on rule-based morphology,我不知道如何将标签(例如 NNP、VBZ)转换为形态向量(例如 VerbForm=Fin、Mood=Ind、Tense=Pres)。是否有内置的tag map 可用?这样的东西(内置)会很有用,但我似乎找不到它:

{
    "NNS":  {POS: NOUN, "Number": "plur"},
    "VBG":  {POS: VERB, "VerbForm": "part", "Tense": "pres", "Aspect": "prog"},
    "DT":   {POS: DET}
    ...
} 

我找到了the PoS Tagging table,但我不知道这个映射是否在代码中可用,甚至直接在解析的令牌中可用?


我在 GitHub 上找到了the tagmap for English,但我不确定如何导入它。有什么帮助吗?

【问题讨论】:

    标签: python python-3.x nlp spacy


    【解决方案1】:

    通过对language class的进一步调查,我发现你可以通过使用获取默认标签映射

    > nlp = spacy.load('en')
    > print(nlp.Defaults.tag_map)
    {'.': {74: 96, 'PunctType': 'peri'}, ',': {74: 96, 'PunctType': 'comm'}, '-LRB-': {74: 96, 'PunctType': 'brck', 'PunctSide': 'ini'}, '-RRB-': {74: 96, 'PunctType': 'brck', 'PunctSide': 'fin'}, '``': {74: 96, 'PunctType': 'quot', 'PunctSide': 'ini'}, '""': {74: 96, 'PunctType': 'quot', 'PunctSide': 'fin'}, "''": {74: 96, 'PunctType': 'quot', 'PunctSide': 'fin'}, ':': {74: 96}, '$': {74: 98, 'Other': {'SymType': 'currency'}}, '#': {74: 98, 'Other': {'SymType': 'numbersign'}}, 'AFX': {74: 83, 'Hyph': 'yes'}, 'CC': {74: 88, 'ConjType': 'coor'}, 'CD': {74: 92, 'NumType': 'card'}, 'DT': {74: 89}, 'EX': {74: 85, 'AdvType': 'ex'}, 'FW': {74: 100, 'Foreign': 'yes'}, 'HYPH': {74: 96, 'PunctType': 'dash'}, 'IN': {74: 84}, 'JJ': {74: 83, 'Degree': 'pos'}, 'JJR': {74: 83, 'Degree': 'comp'}, 'JJS': {74: 83, 'Degree': 'sup'}, 'LS': {74: 96, 'NumType': 'ord'}, 'MD': {74: 99, 'VerbType': 'mod'}, 'NIL': {74: ''}, 'NN': {74: 91, 'Number': 'sing'}, 'NNP': {74: 95, 'NounType': 'prop', 'Number': 'sing'}, 'NNPS': {74: 95, 'NounType': 'prop', 'Number': 'plur'}, 'NNS': {74: 91, 'Number': 'plur'}, 'PDT': {74: 83, 'AdjType': 'pdt', 'PronType': 'prn'}, 'POS': {74: 93, 'Poss': 'yes'}, 'PRP': {74: 94, 'PronType': 'prs'}, 'PRP$': {74: 83, 'PronType': 'prs', 'Poss': 'yes'}, 'RB': {74: 85, 'Degree': 'pos'}, 'RBR': {74: 85, 'Degree': 'comp'}, 'RBS': {74: 85, 'Degree': 'sup'}, 'RP': {74: 93}, 'SP': {74: 102}, 'SYM': {74: 98}, 'TO': {74: 93, 'PartType': 'inf', 'VerbForm': 'inf'}, 'UH': {74: 90}, 'VB': {74: 99, 'VerbForm': 'inf'}, 'VBD': {74: 99, 'VerbForm': 'fin', 'Tense': 'past'}, 'VBG': {74: 99, 'VerbForm': 'part', 'Tense': 'pres', 'Aspect': 'prog'}, 'VBN': {74: 99, 'VerbForm': 'part', 'Tense': 'past', 'Aspect': 'perf'}, 'VBP': {74: 99, 'VerbForm': 'fin', 'Tense': 'pres'}, 'VBZ': {74: 99, 'VerbForm': 'fin', 'Tense': 'pres', 'Number': 'sing', 'Person': 3}, 'WDT': {74: 83, 'PronType': 'int|rel'}, 'WP': {74: 91, 'PronType': 'int|rel'}, 'WP$': {74: 83, 'Poss': 'yes', 'PronType': 'int|rel'}, 'WRB': {74: 85, 'PronType': 'int|rel'}, 'ADD': {74: 100}, 'NFP': {74: 96}, 'GW': {74: 100}, 'XX': {74: 100}, 'BES': {74: 99}, 'HVS': {74: 99}, '_SP': {74: 102}}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 2015-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多