亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何提取與 CoreEntityMention匹配的維基百科實體

如何提取與 CoreEntityMention匹配的維基百科實體

蕭十郎 2023-03-31 14:32:51
我正在對一些文本運行 CoreNLP,并將找到的實體與維基百科實體進行匹配。我想重建為找到的實體提供鏈接和其他有用信息的句子。CoreEntityMention 有一個entity()方法,但它只返回一個字符串。Properties props = new Properties();props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitylink");// set up pipelinepipeline = new StanfordCoreNLP(props);String doc = "text goes here";pipeline.annotate(doc);// Iterate the sentencesfor (CoreSentence sentence : doc.sentences()) {      Go through all mentions      for (CoreEntityMention em : sentence.entityMentions()) {          System.out.println(em.sentence());          // Here I would like to extract the Wikipedia entity information          System.out.println(em.entity());      }    }
查看完整描述

1 回答

?
蝴蝶不菲

TA貢獻1810條經驗 獲得超4個贊

您只需要添加維基百科頁面 url。

所以Neil_Armstrong映射到https://en.wikipedia.org/wiki/Neil_Armstrong.


查看完整回答
反對 回復 2023-03-31
  • 1 回答
  • 0 關注
  • 107 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號