Closed ajtiwari99 closed 5 months ago
Hi,
I ran your test, and looks like you are running 2 different API's
map = matchService.applyMatch(matchDocument, documentList);
For this API, you are matching the searchCust
to documentList
, Here the first record does match, and I am able to see this in the print statement
Match : {{[{'Tiwari'}, {'123456789012'}, {'Rampher'}, {'Amarjeet'}, {'adopt8451z'}]}=[Match{data={[{'Tiwari'}, {'123456789012'}, {'Rampher'}, {'Amarjeet'}, {'adopt8451z'}]}, matchedWith={[{'Tiwari'}, {'123456789012'}, {'Rampher'}, {'Amarjeet'}]}, score=0.9444444444444444}]}
Map<String, List<Match<Document>>> result = matchService.applyMatchByDocId(documentList);
For this API, you are trying to find similarity within the documentList
. I visually cannot see any similar records that would match and the print statement is giving an empty result Match : {}
Just wanted to make sure you are seeing the same results as I am so we can debug this issue.
For reference, I had to modify your example so I could run it without reference to external objects.
here is what I am running
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.intuit.fuzzymatcher.component.MatchService;
import com.intuit.fuzzymatcher.domain.Document;
import com.intuit.fuzzymatcher.domain.Element;
import com.intuit.fuzzymatcher.domain.ElementType;
import com.intuit.fuzzymatcher.domain.Match;
public class SampleTest {
public static void main(String[] args) {
MatchService matchService = new MatchService();
SampleTest test = new SampleTest();
Map<Document, List<Match<Document>>> map;
List<Document> matchDocument = test.loadList();
// Customer searchCust = new Customer();
// searchCust.setId(1);
// searchCust.setfName("Amarjeet");
// searchCust.setmName("Rampher");
// searchCust.setlName("Tiwari");
// searchCust.setAadhar("123456789012");
//searchCust.setAddress("25 avenue");
//searchCust.setPan("asdf345ghb");
Document searchDocument = new Document.Builder(""+1)
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Amarjeet").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Rampher").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Tiwari").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("123456789012").createElement())
//.addElement(new Element.Builder().setType(ElementType.TEXT).setValue(searchCust.getPan()).createElement())
.createDocument();
List<Document> documentList = new ArrayList<>();
documentList.add(searchDocument);
map = matchService.applyMatch(matchDocument, documentList);
System.out.println("Match : " + map);
Map<String, List<Match<Document>>> result = matchService.applyMatchByDocId(documentList);
System.out.println("Match : " + result);
}
public class MatchServiceFactory {
private MatchService matchService = new MatchService();
public MatchService getMatchService() {
return this.matchService;
}
}
//Load the list
public List<Document> loadList() {
// Customer cust = new Customer();
// Customer cust1 = new Customer();
// Customer cust2 = new Customer();
// Customer cust3 = new Customer();
// Customer cust4 = new Customer();
// Customer cust5 = new Customer();
// Customer cust6 = new Customer();
// Customer cust7 = new Customer();
// Customer cust8 = new Customer();
// Customer cust9 = new Customer();
// Customer cust10 = new Customer();
// cust.setId(1);
// cust.setfName("Amarjeet");
// cust.setmName("Rampher");
// cust.setlName("Tiwari");
// cust.setAadhar("123456789012");
// cust.setAddress("137 hopkins ave jersey city");
// cust.setPan("adopt8451z");
//
// cust1.setId(2);
// cust1.setfName("fname2");
// cust1.setmName("mname2");
// cust1.setlName("lname3");
// cust1.setAadhar("12233434");
// cust1.setAddress("25 avenue2");
// cust1.setPan("asdf345ghb2");
//
// cust2.setId(3);
// cust2.setfName("fname3");
// cust2.setmName("mname3");
// cust2.setlName("lname3");
// cust2.setAadhar("122334343");
// cust2.setAddress("25 avenue3");
// cust2.setPan("asdf345ghb3");
Document searchDocument = new Document.Builder(""+1)
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Amarjeet").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Rampher").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("Tiwari").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("123456789012").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("adopt8451z").createElement())
.createDocument();
Document searchDocument1 = new Document.Builder(""+2)
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("fname2").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("mname2").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("lname3").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("12233434").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("asdf345ghb2").createElement())
.createDocument();
Document searchDocument2 = new Document.Builder(""+3)
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("fname3").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("mname3").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("lname3").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("122334343").createElement())
.addElement(new Element.Builder().setType(ElementType.TEXT).setValue("asdf345ghb3").createElement())
.createDocument();
List<Document> documentList = new ArrayList<>();
documentList.add(searchDocument);
documentList.add(searchDocument1);
documentList.add(searchDocument2);
return documentList;
}
}
closing , please feel free to open, if your issue is not resolved
Hi Manish, I am trying to make use of fuzzy-matcher for which i have written one sample test class.( the code is appended below). I am surprised to know the system is not returning match record. I am not able to figure out what wrong has been done.
could you please help? Amarjeet
// Java code start here package test;
import java.util.ArrayList; import java.util.List; import java.util.Map;
import com.intuit.fuzzymatcher.component.MatchService; import com.intuit.fuzzymatcher.domain.Document; import com.intuit.fuzzymatcher.domain.Element; import com.intuit.fuzzymatcher.domain.ElementType; import com.intuit.fuzzymatcher.domain.Match;
public class SampleTest {
}
// Java code ends here