在斯坦福解析器中查找名词和动词

发布于 2024-09-25 20:13:44 字数 419 浏览 12 评论 0原文

我需要找到一个单词是动词还是名词,或者两者都是

例如,单词是“search”,它可以既是名词又是动词,但是斯坦福解析器给它提供了 NN 标签..

斯坦福解析器有什么办法可以假设“搜索”既是名词又是动词?

我现在使用的代码

public static String Lemmatize(String word) {
    WordTag w = new WordTag(word);
    w.setTag(POSTagWord(word));
    Morphology m = new Morphology();
    WordLemmaTag wT = m.lemmatize(w);

    return wT.lemma();
}

还是应该使用任何其他软件来执行此操作?请推荐我 提前致谢

I need to find whether a word is verb or noun or it is both

For example, the word is "search" it can be both noun and a verb but stanford parser gives NN tag to it..

is there any way that stanford parser will give that "search" is both noun and verb?

code that i use now

public static String Lemmatize(String word) {
    WordTag w = new WordTag(word);
    w.setTag(POSTagWord(word));
    Morphology m = new Morphology();
    WordLemmaTag wT = m.lemmatize(w);

    return wT.lemma();
}

or should i use any other software to do it? please suggest me
thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喜爱纠缠 2024-10-02 20:13:44

斯坦福解析器根据上下文统计来猜测单词的词性标签。您确实应该传递一个完整的句子来确定该句子中的“search”是名词还是动词。

您不需要一个完整的解析器来获取词性标签。 Stanford POS Tagger 就足够了;它还包括 Morphology 类,但它也考虑了上下文。

如果您想要英语单词可以采用的所有词性标签,而不给出上下文,那么WordNet 可能是更好的选择。它有几个 Java 接口,包括 JWNLJWI

The Stanford Parser guesses the part-of-speech tag of a word based on context statistics. You should really pass in a complete sentence to determine whether, in that sentence, "search" is a noun or a verb.

You don't need a full parser just to get part-of-speech tags. The Stanford POS Tagger is enough; it also includes the Morphology class, but it too takes context into account.

If you want all part-of-speech tags that an English word can take on, without giving context, then WordNet is probably a better choice. It has several Java interfaces, including JWNL and JWI.

耳根太软 2024-10-02 20:13:44

WordNet 就是您想要的。它为英语词典提供了一个 API,其中包含可能的词性、同义词、词义、上位词/下位词关系等。

请参阅 Yawni 了解出色的纯 Java WordNet API。

WordNet is what you want. It provides an API to an English lexicon with possible parts-of-speech, synonyms, word senses, hypernym/hyponym relations and more.

See Yawni for a great pure-Java WordNet API.

疯到世界奔溃 2024-10-02 20:13:44

斯坦福解析器解析句子上下文中的单词。要使用“搜索”的示例,在任何给定的句子中,“搜索​​”将是名词或动词,但不能在同一个句子中同时是名词和动词。

你要找的是字典查找。我找到了几本在线词典,可以为您提供所需的信息。以下是来自免费在线词典中单词“search”的示例。

事实证明,“搜索”可以是名词、动词、不及物动词和及物动词。

我找不到可以为您提供与免费在线词典网页上相同类型信息的应用程序编程接口 (API)。如果您的词汇表有限,您可以构建自己的 API。

The Stanford parser parses words in the context of a sentence. To use your example of "search", in any given sentence, "search" will be a noun or a verb, but not both a noun and a verb in the same sentence.

What you're looking for is a dictionary look up. I've found several online dictionaries that would give you the information you're looking for. Here's an example from the Free Online Dictionary for the word "search".

It turns out that "search" can be a noun, verb, intransitive verb, and transitive verb.

I could not find an application programming interface (API) that would give you the same type of information as you find on the Free Online Dictionary web page. If your vocabulary list is limited, you could build your own API.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文