Please Visit: http://ift.tt/1ajReyV
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1y8XsQb
via LifeLong Community
Simple Fuzzy String Similarity in Java - CodeProject
public double dice(List<char[]> bigram1, List<char[]> bigram2)
{
List<char[]> copy = new ArrayList<char[]>(bigram2);
int matches = 0;
for (int I = bigram1.size(); --i >= 0;)
{
char[] bigram = bigram1.get(i);
for (int j = copy.size(); --j >= 0;)
{
char[] toMatch = copy.get(j);
if (bigram[0] == toMatch[0] && bigram[1] == toMatch[1])
{
copy.remove(j);
matches += 2;
break;
}
}
}
return (double) matches / (bigram1.size() + bigram2.size());
}
http://ift.tt/1y8XsQ9
http://ift.tt/1mtnVo5
public double dice(List<char[]> bigram1, List<char[]> bigram2)
{
List<char[]> copy = new ArrayList<char[]>(bigram2);
int matches = 0;
for (int I = bigram1.size(); --i >= 0;)
{
char[] bigram = bigram1.get(i);
for (int j = copy.size(); --j >= 0;)
{
char[] toMatch = copy.get(j);
if (bigram[0] == toMatch[0] && bigram[1] == toMatch[1])
{
copy.remove(j);
matches += 2;
break;
}
}
}
return (double) matches / (bigram1.size() + bigram2.size());
}
http://ift.tt/1y8XsQ9
http://ift.tt/1mtnVo5
from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1y8XsQb
via LifeLong Community
No comments:
Post a Comment