斯坦福·内尔没有标注日期和蒂姆

2024-05-15 02:38:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我用的是python中的Stanford NER tagger。它不是标记日期和时间。而是每个单词都返回O。 我的判决是:

“多少钱能在3年内以每年12%的利率获得162美元的利息?”

我在做标记后得到的结果是-

[('What', 'O'), ('sum', 'O'), ('of', 'O'), ('money', 'O'), ('will', 'O'), ('earn', 'O'), ('an', 'O'), ('interest', 'O'), ('of', 'O'), ('$', 'O'), ('162', 'O'), ('in', 'O'), ('3', 'O'), ('years', 'O'), ('at', 'O'), ('the', 'O'), ('rate', 'O'), ('of', 'O'), ('12%', 'O'), ('per', 'O'), ('annum', 'O')]

怎么解决这个问题?在


Tags: of标记an时间单词whatwilltagger
1条回答
网友
1楼 · 发布于 2024-05-15 02:38:20
  1. 下载并安装Stanford NLP Group的Python库stanza。在

    GitHub:https://github.com/stanfordnlp/stanza

  2. 使用Stanford CoreNLP 3.7.0,启动服务器:

    命令:java -Xmx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

    斯坦福大学CoreNLP 3.7.0:https://stanfordnlp.github.io/CoreNLP/download.html

    (注意:确保类路径包含下载文件夹中的所有jar)

  3. 向在步骤2中启动的Java Stanford CoreNLP服务器发出请求:

    from stanza.nlp.corenlp import CoreNLPClient
    
    client = CoreNLPClient(server='http://localhost:9000', default_annotators=['ssplit', 'tokenize', 'lemma', 'pos', 'ner'])
    
    annotated = client.annotate("..text to annotate...")
    
    for sentence in annotated.sentences:
      print " -"
      print sentence.tokens
      print sentence.ner_tags
    

    我们正在努力让Python库处理stanfordcorenlp3.8.0服务器的启动和停止。

相关问题 更多 >

    热门问题