Example #1
0
 public void doMain() throws IOException {
   normalizer = Normalizer.getInstance();
   if (isSurname) {
     searcher = Searcher.getSurnameInstance();
   } else {
     searcher = Searcher.getGivennameInstance();
   }
   if (tableFile != null) {
     logger.info("Reading " + tableFile.getAbsolutePath());
     searcher.readSimilarNames(new FileReader(tableFile));
   }
   evaluate(labeledFile);
 }
Example #2
0
 @Override
 protected boolean match(String name1, String name2) {
   List<String> names1 = normalizer.normalize(name1, isSurname);
   List<String> names2 = normalizer.normalize(name2, isSurname);
   if (names1.size() > 0) {
     name1 = names1.get(0);
   }
   if (names2.size() > 0) {
     name2 = names2.get(0);
   }
   // are we searching on the exact name?
   Collection<String> tokens1 = searcher.getAdditionalSearchTokens(name1);
   if (name1.equals(name2) || tokens1.contains(name2)) {
     return true;
   }
   // are we searching on an additional index token?
   for (String token2 : searcher.getAdditionalIndexTokens(name2)) {
     if (name1.equals(token2) || tokens1.contains(token2)) {
       return true;
     }
   }
   return false;
 }