gpt4 book ai didi

nlp - 使用动态技术的单词之间的语义相似性(使用维基百科)

转载 作者:行者123 更新时间:2023-12-02 17:47:29 27 4
gpt4 key购买 nike

我用 python 编写了一个程序,使用 word net 查找单词之间的语义相似性。但我觉得它是静态的。我想给它一个动态的方法。我想从维基百科访问每个单词的定义。我怎样才能访问这样一个词的定义?当我用谷歌搜索时,我发现通过解析维基百科转储文件我们可以获得定义。但我不知道如何解析。是否有人可以实现解析器以从转储文件中获取单词的定义。这是唯一的方法吗?方法正确。

最佳答案

您不需要重新发明轮子。怀卡托大学的研究人员建立了一个非常好的维基百科数据挖掘服务,称为 WikipediaMiner .

This package converts regular Wikipedia dumps into MySql database format and provides an object-oriented access to parts of Wikipedia like articles, disambiguation pages and hyperlinks. Wikipedia Miner also implements an algorithm for computing semantic relatedness between articles that Maui uses to disambiguate documents to Wikipedia articles and for computing semantic features.

他们还在此基础上公开了各种 API。例如,如果您想获取逻辑回归的定义,只需使用他们的exploreArticle API:

http://wikipedia-miner.cms.waikato.ac.nz/services/exploreArticle?title=logistic%20regression&definition=true

响应 xml 如下所示:

<message service="/services/exploreArticle" id="226631" title="Logistic regression">
<request>
<param name="title">logistic regression</param>
<param name="definition">true</param>
</request>
<definition><![CDATA[In <a href="http://www.en.wikipedia.org/wiki/Statistics">statistics</a>, <b>logistic regression</b> (sometimes called the <b>logistic model</b> or <b><a href="http://www.en.wikipedia.org/wiki/Logit">logit</a> model</b>) is used for prediction of the <a href="http://www.en.wikipedia.org/wiki/Probability">probability</a> of occurrence of an event by fitting data to a logit function <a href="http://www.en.wikipedia.org/wiki/Logistic function">logistic curve</a>.]]>
</definition>
</message>

比较单词之间的语义相似度,您可以尝试他们的compare API。

例如,将 kiwitakahe 进行比较,您可以使用以下 API 调用:

http://wikipedia-miner.cms.waikato.ac.nz/services/compare?term1=kiwi&term2=takahe&disambiguationDetails&connections&snippets

Here是有关他们用于相关性度量的算法的更多详细信息。

您还可以托管自己的 wikipediaMiner 服务(详情 here )。在 here 找到更多关于如何使用他们的服务的信息.他们的相关出版物是 here .

关于nlp - 使用动态技术的单词之间的语义相似性(使用维基百科),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866776/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com