LCSMatcher extends AbstractAttributeMatcher { @Override public double getWeight(String string1, String string2) { final int lcs = longestSubstr(string1, string2); long maxLength = Math.max(string1.codePoints().count(), string2.codePoints().count()); return ((double) lcs) / maxLength; }  @Override AttributeMatcherType getMatchType(); @Override double getWeight(String string1, String string2);  }
@Test public void testGetWeight() { LCSMatcher lcsMatcher = new LCSMatcher(); double weight = lcsMatcher.getWeight("abcd", "abcfg"); assertTrue(weight == 0.6d); weight = lcsMatcher.getWeight("𠀀𠀁", "𠀀𠀁我ab"); assertTrue(weight == 0.4d); }