MFBRecordMatcher extends AbstractRecordMatcher { @Override public double getMatchingWeight(String[] record1, String[] record2) { return getMatchingWeight(buildRecord(record1), buildRecord(record2)).getNormalizedConfidence(); } MFBRecordMatcher(double minConfidenceValue); @Override double getMatchingWeight(String[] record1, String[] record2); @Override MatchResult getMatchingWeight(Record record1, Record record2); void setSurvivorShipFunction(String[] survivorShipFunctions); void setSurvivorShipFunction(SurvivorShipAlgorithmEnum[] surAlgorithms);  }
@Test public void testGetMatchingWeightRecordRecordForSameInputAttributeThreshold0_8() { Record record1 = new Record(null, 0, StringUtils.EMPTY); Attribute attribute = new Attribute("0"); attribute.setValue("jinan"); record1.getAttributes().add(attribute); Record record2 = new Record(null, 0, StringUtils.EMPTY); attribute = new Attribute("1"); attribute.setValue("jinan"); record2.getAttributes().add(attribute); IAttributeMatcher[] attributeMatchers = new IAttributeMatcher[] { MFBAttributeMatcher.wrap(new JaroMatcher(), 1.0, 0.8, SubString.NO_SUBSTRING) }; MFBRecordMatcher mfbRecordMatcher = new MFBRecordMatcher(0.85d); mfbRecordMatcher.setRecordSize(1); Assert.assertTrue("setAttributeMatchers fail", mfbRecordMatcher.setAttributeMatchers(attributeMatchers)); MatchResult matchingResult = mfbRecordMatcher.getMatchingWeight(record1, record2); Assert.assertEquals("1.0", String.valueOf(matchingResult.getScores().get(0).score)); }
@Test public void testGetMatchingWeightRecordRecordForDifferentInputAttributeThreshold0_8() { Record record1 = new Record(null, 0, StringUtils.EMPTY); Attribute attribute = new Attribute("0"); attribute.setValue("jinanjinanjinanjinan"); record1.getAttributes().add(attribute); Record record2 = new Record(null, 0, StringUtils.EMPTY); attribute = new Attribute("1"); attribute.setValue("jinanjinan"); record2.getAttributes().add(attribute); IAttributeMatcher[] attributeMatchers = new IAttributeMatcher[] { MFBAttributeMatcher.wrap(new JaroMatcher(), 1.0, 0.8, SubString.NO_SUBSTRING) }; MFBRecordMatcher mfbRecordMatcher = new MFBRecordMatcher(0.85d); mfbRecordMatcher.setRecordSize(1); Assert.assertTrue("setAttributeMatchers fail", mfbRecordMatcher.setAttributeMatchers(attributeMatchers)); MatchResult matchingResult = mfbRecordMatcher.getMatchingWeight(record1, record2); Assert.assertEquals("0.8333333134651184", String.valueOf(matchingResult.getScores().get(0).score)); }
@Test public void testGetMatchingWeightRecordRecordForSameInputAttributeThreshold1_0() { Record record1 = new Record(null, 0, StringUtils.EMPTY); Attribute attribute = new Attribute("0"); attribute.setValue("jinan"); record1.getAttributes().add(attribute); Record record2 = new Record(null, 0, StringUtils.EMPTY); attribute = new Attribute("1"); attribute.setValue("jinan"); record2.getAttributes().add(attribute); IAttributeMatcher[] attributeMatchers = new IAttributeMatcher[] { MFBAttributeMatcher.wrap(new JaroMatcher(), 1.0, 1.0, SubString.NO_SUBSTRING) }; MFBRecordMatcher mfbRecordMatcher = new MFBRecordMatcher(0.85d); mfbRecordMatcher.setRecordSize(1); Assert.assertTrue("setAttributeMatchers fail", mfbRecordMatcher.setAttributeMatchers(attributeMatchers)); MatchResult matchingResult = mfbRecordMatcher.getMatchingWeight(record1, record2); Assert.assertEquals("1.0", String.valueOf(matchingResult.getScores().get(0).score)); }
@Test public void testGetMatchingWeightRecordRecordForDifferentInputAttributeThreshold1_0() { Record record1 = new Record(null, 0, StringUtils.EMPTY); Attribute attribute = new Attribute("0"); attribute.setValue("jinanjinanjinanjinan"); attribute.getValues().get("jinan"); record1.getAttributes().add(attribute); Record record2 = new Record(null, 0, StringUtils.EMPTY); attribute = new Attribute("1"); attribute.setValue("jinanjinan"); attribute.getValues().get("jinan"); record2.getAttributes().add(attribute); IAttributeMatcher[] attributeMatchers = new IAttributeMatcher[] { MFBAttributeMatcher.wrap(new JaroMatcher(), 1.0, 1.0, SubString.NO_SUBSTRING) }; MFBRecordMatcher mfbRecordMatcher = new MFBRecordMatcher(0.85d); mfbRecordMatcher.setRecordSize(1); Assert.assertTrue("setAttributeMatchers fail", mfbRecordMatcher.setAttributeMatchers(attributeMatchers)); MatchResult matchingResult = mfbRecordMatcher.getMatchingWeight(record1, record2); Assert.assertEquals("1.0", String.valueOf(matchingResult.getScores().get(0).score)); }