找到一个单词的词根

发布于 2024-10-26 17:59:08 字数 147 浏览 1 评论 0原文

我需要建立一个 php 字典,它将找到一个单词的根词。 前任。搜索“汽车”,它会告诉你“汽车是汽车的复数” 或者“take”,它是“take的过去式”

我正在考虑使用Wordnet,但它看起来很复杂。

有什么建议吗?我绝望的

问候;

I need to build a php dictionary, which will find the root word of a word.
Ex. search "cars", it will tell "Cars is plural of car"
Or "took", it's "the past tense of take"

I am considering using Wordnet, but it seems complicated.

Any suggestion? m desperated

Regards;

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

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

发布评论

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

评论(3

偏闹i 2024-11-02 17:59:08

好吧,由于建议的词干分析器不适合您,您可以从这里选择一些更适合您的词干分析器:

http:// /snowball.tartarus.org/

这里还有一些有趣的库: http://sourceforge.net /projects/nlp/

还链接到 StackOverflow 上的类似问题:

使用 PHP 的 NLP 编程工具?

使用 PHP 进行文本挖掘

更新:
如何进行词词干提取或词形还原?

http://www.reddit.com/r/programming/comments/8e5d3/how_do_i_programatically_do_stemming_eg_eating_to/

http://www.nltk.org/

Wordnet 词形还原器:http://wordnet.princeton.edu/wordnet/download/

Well, since suggested stemmer does not work correctly for you, you can choose some, that suits you better from here:

http://snowball.tartarus.org/

Here is also some interesting library: http://sourceforge.net/projects/nlp/

Also links to similiar questions on StackOverflow:

NLP programming tools using PHP?

Text mining with PHP

UPDATE:
How do I do word Stemming or Lemmatization?

http://www.reddit.com/r/programming/comments/8e5d3/how_do_i_programatically_do_stemming_eg_eating_to/

http://www.nltk.org/

Wordnet lemmatizer: http://wordnet.princeton.edu/wordnet/download/

旧人哭 2024-11-02 17:59:08

好吧,这是一个可以进行词干提取的扩展(我相信这就是您想要的):
http://pecl.php.net/package/stem

它不做任何语法分析然而,工作的内容。

这是仅 php 版本: http://www.chuggnutt.com/stemmer.php

Well, here is an extension that does word stemming (I beleive this is around what you want):
http://pecl.php.net/package/stem

It doesn't do any grammatical analysis of the work, however.

Here is php-only version: http://www.chuggnutt.com/stemmer.php

只怪假的太真实 2024-11-02 17:59:08

您可以在这里尝试免费的 Lemmatizer API: http://twinword.com/lemmatizer.php

向下滚动到找到词形还原端点。

这将使您能够将“狗”变为“狗”,将“能力”变为“能力”。

如果您传入一个名为“text”的 POST 或 GET 参数以及一个类似“walked plant”的字符串:

// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest\Request::post("[ENDPOINT URL]",
  array(
    "X-Mashape-Key" => "[API KEY]",
    "Content-Type" => "application/x-www-form-urlencoded",
    "Accept" => "application/json"
  ),
  array(
    "text" => "walked plants"
  )
);

您会得到如下响应:

{
  "lemma": {
    "plant": 1,
    "walk": 1
  },
  "result_code": "200",
  "result_msg": "Success"
}

You can try the free Lemmatizer API here: http://twinword.com/lemmatizer.php

Scroll down to find the Lemmatizer endpoint.

This will allow you to get "dogs" to "dog", "abilities" to "ability".

If you pass in a POST or GET parameter called "text" with a string like "walked plants":

// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest\Request::post("[ENDPOINT URL]",
  array(
    "X-Mashape-Key" => "[API KEY]",
    "Content-Type" => "application/x-www-form-urlencoded",
    "Accept" => "application/json"
  ),
  array(
    "text" => "walked plants"
  )
);

You get a response like this:

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