词消歧算法(Lesk算法) [英] word disambiguation algorithm (Lesk algorithm)

查看:2866
本文介绍了词消歧算法(Lesk算法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许志国.. 任何人可以帮助我找到一个算法的Java code查找基于上下文搜索词的同义词,我要实现的算法WordNet的数据库。

Hii.. Can anybody help me to find an algorithm in Java code to find synonyms of a search word based on the context and I want to implement the algorithm with WordNet database.

例如,我运行一个Java程序。从上下文,我想找到的同义词跑这个词,但同义词必须根据上下文是合适的。

For example, "I am running a Java program". From the context, I want to find the synonyms for the word "running", but the synonyms must be suitable according to a context.

推荐答案

让我来举例说明一个可能的方法:

Let me illustrate a possible approach:

  1. 让你的句子是 A B C
  2. 让每一个字都同义词集即 {A:(A1,A2,A3),B:(B1),C(C1,C2)}
  3. 现在,形成可能的同义词集合集:(A1,B1,C1),(A1,B1,C2),(A2,B1,C1)...(A3,B1,C2)
  4. 定义功能 F(A,B,C)返回之间的距离(分值)(A,B,C)。
  5. 在调用F每个同义词集合集。
  6. 选择设定的最高得分。
  1. Let your sentence be A B C
  2. Let each word have synsets i.e. {A:(a1, a2, a3), B:(b1), C:(c1, c2)}
  3. Now form possible synset sets: (a1, b1, c1), (a1, b1, c2), (a2, b1, c1) ... (a3, b1, c2)
  4. Define function F(a, b, c) which returns the distance (score) between (a, b, c).
  5. Call F on each synset set.
  6. Pick the set with the maximum score.

对于初学者来说,函数F可以只返回节点的两个节点之间的数的倒数的乘积:

For starters, the function F can just return the product of the inverse of the number of nodes between the two nodes:

最大化(产品[i = 0到的len(句子); J = 0到的len(句子)](1 / D(node_i,node_j)))

Maximize(Product[i=0 to len(sentence); j=0 to len(sentence)] (1/D(node_i, node_j)))

之后,你可以增加其复杂性。

Later on, you can increase its complexity.

这篇关于词消歧算法(Lesk算法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆