0
私は、corenlp.runが「明日の午前10時」を識別して時間として解析できることに気付きました。しかし、私が見たトレーニングチュートリアルとドキュメントでは、1行につき1語しか使用できません。フレーズを理解するにはどうしたらいいですか? 関連するメモには、複合エンティティにタグを付ける方法はありますか?スタンフォードNERのフレーズまたはコンパウンドエンティティ
私は、corenlp.runが「明日の午前10時」を識別して時間として解析できることに気付きました。しかし、私が見たトレーニングチュートリアルとドキュメントでは、1行につき1語しか使用できません。フレーズを理解するにはどうしたらいいですか? 関連するメモには、複合エンティティにタグを付ける方法はありますか?スタンフォードNERのフレーズまたはコンパウンドエンティティ
このような時間関連のフレーズは、SUTimeライブラリによって認識されます。詳細はこちらをご覧ください:https://nlp.stanford.edu/software/sutime.html
ner
タグ付けが完了した後にエンティティを抽出する機能があります。
たとえば、Joe Smith went to Hawaii .
にPERSON PERSON O O LOCATION O
と入力すると、Joe Smith
とHawaii
が抽出されます。これにはentitymentions
注釈が必要です。ここで
は、いくつかのサンプルコードです:
package edu.stanford.nlp.examples;
import edu.stanford.nlp.pipeline.*;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.util.*;
import java.util.*;
public class EntityMentionsExample {
public static void main(String[] args) {
Annotation document =
new Annotation("John Smith visited Los Angeles on Tuesday.");
Properties props = new Properties();
//props.setProperty("regexner.mapping", "small-names.rules");
props.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitymentions");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
pipeline.annotate(document);
for (CoreMap entityMention : document.get(CoreAnnotations.MentionsAnnotation.class)) {
System.out.println(entityMention);
//System.out.println(entityMention.get(CoreAnnotations.TextAnnotation.class));
System.out.println(entityMention.get(CoreAnnotations.EntityTypeAnnotation.class));
}
}
}
私はgithubのソースコードからこれを実行すると 'によって引き起こさに実行している:にjava.io.IOException:開くことができません「EDU /スタンフォード/ NLP /モデル/pos-tagger/english-left3words/english-left3words-distsim.tagger "クラスパス、ファイル名、またはURLとして使用する" – user1170883
CLASSPATHにlibとliblocalのモデルjarとすべてのjarが必要です。最新のモデルはGitHubのメインページからjarし、libとliblocalのフォルダはGitHubでもアクセス可能です。 – StanfordNLPHelp