Matches two strings with WNHeirarchy matcher.

@param source gloss of source label
@param target gloss of target label
@return synonym or IDk relation
769957
public char match(ISense source, ISense target) throws MatcherLibraryException {
        List<ISense> sourceList = getAncestors(source, depth);
        List<ISense> targetList = getAncestors(target, depth);
        targetList.retainAll(sourceList);
        if (targetList.size() > 0)
            return IMappingElement.EQUIVALENCE;
        else
            return IMappingElement.IDK;
    }
1196643
private void setStrongestMapping(INode source, INode target) {
        //if it's structure preserving
        if (isSameStructure(source, target)) {
            spsmMapping.setRelation(source, target, defautlMappings.getRelation(source, target));

            //deletes all the less precedent relations for the same source node
            for (INode node : defautlMappings.getTargetContext().getNodesList()) {
                //if its not the target of the mapping elements and the relation is weaker
                if (source != node && defautlMappings.getRelation(source, node) != IMappingElement.IDK
                        && isPrecedent(defautlMappings.getRelation(source, target), defautlMappings.getRelation(source, node))) {
                    defautlMappings.setRelation(source, node, IMappingElement.IDK);
                }
            }

            //deletes all the less precedent relations for the same target node
            for (INode node : defautlMappings.getSourceContext().getNodesList()) {
                if (target != node) {
                    defautlMappings.setRelation(node, target, IMappingElement.IDK);
                }
            }
        } else {
            //the elements are not in the same structure, look for the correct relation
            computeStrongestMappingForSource(source);
        }
    }
951972
public static final Enumeration<String> getAvailableVariants(String source,
                                                         String target) {
        return registry.getAvailableVariants(source, target);
    }
681532
@Override
    public boolean matches(TargetProperties targetConatiner, IBond targetBond) {
        if (this.smartQueryBond != null) {
            return smartQueryBond.matches(targetBond);
        } else {
            if (!isBondMatchFlag()) {
                return true;
            }
            if (isBondMatchFlag() && isBondTypeMatch(targetBond)) {
                return true;
            }
            if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) {
                return true;
            }
        }
        return false;
    }
976798
public Map<String, Float> findSynonyms(String target, int cnt) {
    float[] vec = transform(target);

    if ((vec == null) || (cnt == 0))
      return Collections.emptyMap();

    int[] synonyms = new int[cnt];
    float[] scores = new float[cnt];


    int min = 0;
    for (int i = 0; i < cnt; i++) {
      synonyms[i] = i;
      scores[i] = cosineSimilarity(vec, i * vec.length, _output._vecs);
      if (scores[i] < scores[min])
        min = i;
    }

    final int vocabSize = _output._vocab.size();
    for (int i = cnt; i < vocabSize; i++) {
      float score = cosineSimilarity(vec, i * vec.length, _output._vecs);
      if ((score <= scores[min]) || (score >= 0.999999))
        continue;
      synonyms[min] = i;
      scores[min] = score;
      // find a new min
      min = 0;
      for (int j = 1; j < cnt; j++)
        if (scores[j] < scores[min])
          min = j;
    }

    Map<String, Float> result = new HashMap<>(cnt);
    for (int i = 0; i < cnt; i++)
      result.put(_output._words[synonyms[i]].toString(), scores[i]);
    return result;
  }
1139422
public static int indexOf(String source, String target, int fromIndex, int toIndex) {
		if(fromIndex>toIndex) throw new IllegalArgumentException("fromIndex>toIndex: fromIndex="+fromIndex+", toIndex="+toIndex);

		int sourceCount = source.length();

		// This line makes it different than regular String indexOf method.
		if(toIndex<sourceCount) sourceCount = toIndex;

		int targetCount = target.length();

		if (fromIndex >= sourceCount) {
			return (targetCount == 0 ? sourceCount : -1);
	}
		if (fromIndex < 0) {
			fromIndex = 0;
		}
	if (targetCount == 0) {
		return fromIndex;
	}

		char first  = target.charAt(0);
		int max = sourceCount - targetCount;

		for (int i = fromIndex; i <= max; i++) {
			/* Look for first character. */
			if (source.charAt(i) != first) {
				while (++i <= max && source.charAt(i) != first) {
					// Intentionally empty
				}
			}

			/* Found first character, now look at the rest of v2 */
			if (i <= max) {
				int j = i + 1;
				int end = j + targetCount - 1;
				for (int k = 1; j < end && source.charAt(j) == target.charAt(k); j++, k++) {
					// Intentionally empty
				}

				if (j == end) {
					/* Found whole string. */
					return i;
				}
			}
		}
		return -1;
	}
209101
public static void merge(List<String> sources, String target) throws IOException{
        //读取所有需要合并的词典
        Set<String> set = new HashSet<>();
        AtomicInteger i = new AtomicInteger();
        for(String source : sources){
            try(Stream<String> lines = Files.lines(Paths.get(source), Charset.forName("utf-8"))){
                lines.forEach(line -> {
                    i.incrementAndGet();
                    line = line.trim();
                    // 词长度：大于等于2并且小于等于4
                    // 识别功能 能识别的词 就不用放到词典中了，没必要多此一举
                    //至少要两个中文字符，防止大量无意义或特殊词混入词典
                    if (line.length() > 4
                            || line.length() < 2
                            || !Utils.isChineseCharAndLengthAtLeastTwo(line)
                            || RecognitionTool.recog(line)) {
                        LOGGER.debug("过滤：" + line);
                        return;
                    }
                    set.add(line);
                });
            }
        }
        LOGGER.info("合并词数："+i.get());
        LOGGER.info("保留词数："+set.size());
        List<String> list = set.stream().sorted().collect(Collectors.toList());
        Files.write(Paths.get(target), list, Charset.forName("utf-8"));
    }
499942
public boolean match(String destinationName)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "match", destinationName);

    boolean matches = false;
    if(!patternIsWildcarded)
    {
      // Match the name directly through String equality
      matches = destinationName.equals(destinationNamePatternString);
    }
    else
    {
      // We need to match a wildcarded expression
      if(destinationName.startsWith(wildcardStem))
      {
        //A candidate for full matching as the stem is the same              
        try
        {
          matches = mpm.evaluateDiscriminator(destinationName, 
                                              destinationNamePatternString,
                                              parsedPattern);
        } 
        // Any discriminator exceptions should have been caught at the prepare()
        // stage, so ffdc, etc.
        catch (SIDiscriminatorSyntaxException e)
        {
          // FFDC
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.impl.DestinationNamePattern.match",
            "1:141:1.2",
            this);

          SibTr.exception(tc, e);
          
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "match", "SIErrorException");
          
          SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
            new Object[] {
              "com.ibm.ws.sib.processor.impl.DestinationNamePattern",
              "1:152:1.2",
              e });
          
          throw new SIErrorException(
            nls.getFormattedMessage(
              "INTERNAL_MESSAGING_ERROR_CWSIP0002",
              new Object[] {
                "com.ibm.ws.sib.processor.impl.DestinationNamePattern",
                "1:160:1.2",
                e },
              null),
            e);
        }   
      }
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "match", Boolean.valueOf(matches));
    return matches;
  }
623753
@Override
    public boolean matches(IAtomContainer targetContainer, IBond targetBond) {
        if (this.smartQueryBond != null && queryBond == null) {
            return smartQueryBond.matches(targetBond);
        } else {
            if (!isBondMatchFlag()) {
                return true;
            }
            if (isBondMatchFlag() && isBondTypeMatch(targetBond)) {
                return true;
            }
            if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetContainer, targetBond)) {
                return true;
            }
        }
        return false;
    }
82021
function compareCssText( source, target )
	{
		typeof source == 'string' && ( source = parseStyleText( source ) );
		typeof target == 'string' && ( target = parseStyleText( target ) );
		for( var name in source )
		{
			if ( !( name in target &&
					( target[ name ] == source[ name ]
						|| source[ name ] == 'inherit'
						|| target[ name ] == 'inherit' ) ) )
			{
				return false;
			}
		}
		return true;
	}
302304
public static Betner betnNext(String target, String leftSameWithRight) {
		return betn(target).betweenNext(leftSameWithRight);
	}
1089124
protected static boolean match(Object ref, Object test) {
    if(ref == null) {
      return false;
    }
    // Cheap and fast, may hold for class labels!
    if(ref == test) {
      return true;
    }
    if(ref instanceof LabelList && test instanceof LabelList) {
      final LabelList lref = (LabelList) ref;
      final LabelList ltest = (LabelList) test;
      final int s1 = lref.size(), s2 = ltest.size();
      if(s1 == 0 || s2 == 0) {
        return false;
      }
      for(int i = 0; i < s1; i++) {
        String l1 = lref.get(i);
        if(l1 == null) {
          continue;
        }
        for(int j = 0; j < s2; j++) {
          if(l1.equals(ltest.get(j))) {
            return true;
          }
        }
      }
    }
    // Fallback to equality, e.g. on class labels
    return ref.equals(test);
  }
986350
public int findIn(Source source) {
        if (regex != null) {
            Matcher matcher = regex.matcher(source.subToEnd());
            if (matcher.find()) {
                return source.getOffset() + matcher.start();
            } else {
                return -1;
            }
        } else {
            return -1;
        }
    }
1028357
String getTargetInternalName(String sourceInternalName, String targetPackage) {
        StringBuilder targetInternalName = new StringBuilder();
        targetInternalName.append(targetPackage.replaceAll("\\.", "/"));

        int lastSlashIndex = sourceInternalName.lastIndexOf('/');
        targetInternalName.append(sourceInternalName.substring(lastSlashIndex));

        return targetInternalName.toString();
    }
636964
public static Matcher<CharSequence> similar(final CharSequence target, final int levenshteinDistance) {
        return IsSimilar.similar(target, levenshteinDistance);
    }
924119
public static boolean match(String keyword, TargetAtom atom) {
        return atom.getSubstitutedTerms().stream()
                .anyMatch(t -> match(keyword, t));

    }
537408
public StringGrabber replace(String target, String replacement) {
		sb = new StringBuilder(sb.toString().replace(target, replacement));
		return StringGrabber.this;
	}