我正在尝试对通用短语执行pos标签。
使用该代码,对应于动词,只有“ V”返回给我,但是我还想获取有关动词的特定信息(例如时间,人等)。
如何获取有关标签的特定信息(VB,VBG,VBD,ecc)?
void partOfSpeach(String s) throws IOException{
TintPipeline pipeline = new TintPipeline();
Properties props;
props = new Properties();
props.setProperty("annotators", "ita_toksent , ita_lemma , pos, ner, parse");
props.setProperty("pos.model", "models/italian-big.tagger");
props.setProperty("ita_toksent.model", "/Users/alessio/Desktop/token-settings.xml");
props.setProperty("customAnnotatorClass.ita_toksent", "eu.fbk.dh.tint.tokenizer.annotators.ItalianTokenizerAnnotator");
pipeline.loadDefaultProperties();
pipeline.load();
Annotation stanfordAnnotation = pipeline.runRaw(s);
List<CoreMap> sentences = stanfordAnnotation.get(SentencesAnnotation.class);
for (CoreMap sentence : sentences) { for (CoreLabel token : sentence.get(TokensAnnotation.class)) {
String word = token.get(TextAnnotation.class);
String pos = token.get(PartOfSpeechAnnotation.class);
System.out.println(word + " " + pos); } } }
输出: 曹(I) 索诺(V) 弗朗切斯科(SP) ed(CC) 何(V) 24(北) 安妮(S)