Examples of MatchUtilsResult


Examples of dnb.util.MatchUtils.MatchUtilsResult

    SimilarScanResult.Match<Label> mt;
   
    String pt = null;
    int dst;
    // normalize & split passed name
    MatchUtilsResult in = MatchUtils.getPartsNormalize(name);
   
    // brute force 4 labels 2 get max match propability ;-)
    LabelHibernateImpl l;
    for (Label ll : labels) {
      l = (LabelHibernateImpl) ll;
      // get distance of the normed names 2 each other
      dst =  StringUtils.getLevenshteinDistance(in.getNormalized(), l.getNormalizedName());
      if (dst == 0) {
        LOGGER.info("Found exact match for label " + name);
        mt = new SimilarScanResult.Match<Label>(SimilarScanResult.MatchType.EXACT, ll.getName(), ll)
        if (ssr == null) { ssr = new SimilarScanResult<Label>(mt); } else { ssr.add(mt); }       
        return ssr; // => we got an exact match => cancel search       
      } else if (dst <= LDISTANCE_LABEL) {
        LOGGER.info("Found similar match:" + name);
        mt = new SimilarScanResult.Match<Label>(dst, ll.getName(), ll);
        if (ssr == null) { ssr = new SimilarScanResult<Label>(mt); } else { ssr.add(mt); }
      } else { // no relevant distance => check part match       
        if (in.getParts() != null) { // we got multiple parts in the passed string => try part find
          pt = l.matchParts(in.getParts())// match the current label against the words of this label name
          if (pt != null) { // part match found
            LOGGER.info("Found part match '" + pt + "' for label " + l.getName());
            mt = new SimilarScanResult.Match<Label>(SimilarScanResult.MatchType.PART, pt, ll)
            if (ssr == null) { ssr = new SimilarScanResult<Label>(mt); } else { ssr.add(mt); }
          }
View Full Code Here

Examples of dnb.util.MatchUtils.MatchUtilsResult

    this.parent = parent;
    init(getName());
  }
 
  private void init(String name) {
    MatchUtilsResult mur = MatchUtils.getPartsNormalize(name);
    parts = mur.getParts();
    normalizedName = mur.getNormalized();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.