Closed nayan-jyoti closed 3 years ago
Hi Nayan,
The usage of the library looks accurate .
Here are modifications to your example with applyMatchByGroups
String[] input = new String[]{"Nayan J 123", "Nayan J Bayan 123"};
Document document = null;
List<Document> documentList = new ArrayList<>();
for (String str : input) {
document = new Document.Builder(str)
.addElement(new Element.Builder<String>().setValue(str).setType(ElementType.TEXT).createElement())
.createDocument();
documentList.add(document);
}
Set<Set<Match<Document>>> result = matchService.applyMatchByGroups(documentList);
result.forEach(entry -> {
entry.forEach(match -> {
System.out.println("Data: " + match.getData() + " Matched With: " + match.getMatchedWith() + " Score: "
+ match.getScore().getResult());
});
});
Hope this helps
Thanks
Hi Manish,
Thanks for prompt response. It was indeed helpful.
document = new Document.Builder(str).addElement(new Element.Builder<String>().setValue(str) .setType(ElementType.TEXT).setThreshold(0.0).createElement()).createDocument();
I played with few more string pairs after setting threshold value to 0.0 like above:
However none of them returned any result. Is it expected behaviour?
Edit:
com.intuit.fuzzymatcher.exception.MatchException: Data Type not supported
Tried the same with ElementType.NAME, met same exception.Thanks
Hi Nayan,
ElementType.NAME
is a better choice for this kind of match. It uses Soundex to match names, and negates any misspelled or closely spelled differences in names.
Nearest Neighbors are a better choice for numeric and date type elements where values are near each other and not the same.
I see you have reduced Threshold value. If you use that on the document instead of Element, you will see them match
String[] input = new String[]{"Nayan Jyoti Bayan Test", "Nayan Jyoti B T"};
Document document = null;
List<Document> documentList = new ArrayList<>();
for (String str : input) {
document = new Document.Builder(str)
.addElement(new Element.Builder<String>().setValue(str).setType(ElementType.NAME).createElement())
.setThreshold(0.49)
.createDocument();
documentList.add(document);
}
Set<Set<Match<Document>>> result = matchService.applyMatchByGroups(documentList);
result.forEach(entry -> {
entry.forEach(match -> {
System.out.println("Data: " + match.getData() + " Matched With: " + match.getMatchedWith() + " Score: "
+ match.getScore().getResult());
});
});
Thanks for the explanation. Able to get scores after setting threshould at document level. Thank you again for your time.
Closing the issue as my queries are answered
Hi,
I came across this library and tried some very elementary test, matching two strings to find the score. After going through readme file, several null pointer exceptions and issues already raised, I finally able to play something around that by doing this: `List input = Arrays.asList(firstStr, secondStr);
However it is found that:
Thanks