本文介绍了如何使用jaro-winkler查找表中最接近的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有一个jaro-winkler算法的实现.我没有写这个功能.该函数比较两个值并给出匹配的可能性.

I have an implementation of the jaro-winkler algorithm in my database. I did not write this function. The function compares two values and gives the probability of match.

所以jaro(string1,string2,matchnoofchars)将返回结果.

So jaro(string1, string2, matchnoofchars) will return a result.

我不想比较两个字符串,而是要发送一个具有matchnoofchars的字符串,然后获得概率高于95%的结果集.

Instead of comparing two strings, I want to send one string with a matchnoofchars and then get a result set with the probability higher than 95%.

例如,当前函数能够为jaro("Philadelphia","Philadelphlaa",9)返回97.62%

For example the current function is able to return 97.62% for jaro("Philadelphia","Philadelphlaa",9)

我希望调整此功能,以便能够为费城"的输入找到费城".为此,我需要进行哪些更改?

I wish to tweak this function so that I am able to find "Philadelphia" for an input of "Philadelphlaa". What kind of changes do I need to make for this to happen?

我正在使用Oracle 9i.

I am using Oracle 9i.

推荐答案

DECLARE
  CURSOR citynames IS
    SELECT city FROM table_loc_master where statecode = 'PQ';
  CURSOR leasecity IS
    SELECT city FROM table_loc where State = 'PQ'
    MINUS
    SELECT to_char(city) city FROM table_loc_master where statecode = 'PQ';
  xProb NUMBER(10,8);
BEGIN
  FOR x_rec IN leasecity
  LOOP
      FOR y_rec IN citynames
      LOOP
            xProb := jwrun(x_rec.city,y_rec.city,length(y_rec.city));
            If xProb > 0.97 Then
               DBMS_OUTPUT.PUT_LINE('Source : ' || x_rec.city || ' Target: ' || y_rec.city );
            End if;
      END LOOP;
  END LOOP;
END;

这篇关于如何使用jaro-winkler查找表中最接近的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 23:41