使用 Stanford-Parser 从文本中提取阿拉伯语专有名词 [英] Extracting Arabic Proper Names from a text using Stanford-Parser
本文介绍了使用 Stanford-Parser 从文本中提取阿拉伯语专有名词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用斯坦福解析器从文本中提取阿拉伯语专有名词.
I am trying to extract Arabic proper names from a text using Stanford Parser.
例如,如果我有一个输入语句:
for example if I have an input sentence:
تكريم سعد الدين الشاذلى
使用阿拉伯语斯坦福解析器,树状图将是:
using the Arabic Stanford parser, the tree diagram will be:
(ROOT (NP (NN تكريم) (NP (NNP سعد) (DTNNP الدين) (NNP الشاذلى))))
我想提取正确的名称:
سعد الدين الشاذلى
有子树:
(NP (NNP سعد) (DTNNP الدين) (NNP الشاذلى))
我试过这个:类似问题一个>
但是这一行有一些错误:
but there is some thing wrong in this line:
List<TaggedWord> taggedWords = (Tree) lp.apply(str);
将树类型放入标记词列表中的错误我不明白的另一件事是我在哪里可以使用建议的 taggedYield()
函数
the error in putting a tree type in a list of taggedword
another thing that I didnot understand that where could i use the suggested taggedYield()
function
有什么想法吗?
推荐答案
关于库,这是非常基本的 Java,但您想要的是:
This is pretty basic Java with respect to the library, but what you want is:
Tree tree = lp.apply(str);
List<TaggedWord> taggedWords = tree.taggedYield();
for (TaggedWord tw : taggedWords) {
if (tw.tag().contains("NNP")) {
System.err.println(tw.word());
}
}
这篇关于使用 Stanford-Parser 从文本中提取阿拉伯语专有名词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文