Finds covering matches from the remainder.
12762
private List<Filter<S>> findCoveringMatches() {
        List<Filter<S>> coveringFilters = null;

        boolean check = !mRemainderFilters.isEmpty()
            && (mIdentityFilters.size() > 0
                || mRangeStartFilters.size() > 0 
                || mRangeEndFilters.size() > 0);

        if (check) {
            // Any remainder property which is provided by the index is a covering match.
            for (Filter<S> subFilter : mRemainderFilters) {
                if (isProvidedByIndex(subFilter)) {
                    if (coveringFilters == null) {
                        coveringFilters = new ArrayList<Filter<S>>();
                    }
                    coveringFilters.add(subFilter);
                }
            }
        }

        return prepareList(coveringFilters);
    }
214031
private Set<T> findMatching(R resolvable) {
        Set<T> result = new HashSet<T>();
        for (T bean : getAllBeans(resolvable)) {
            if (matches(resolvable, bean)) {
                result.add(bean);
            }
        }
        return result;
    }
1275828
def get_close_matches(word, possibilities, n=None, cutoff=0.6):
    """"""
    if n is None:
        n = settings.num_close_matches
    return difflib_get_close_matches(word, possibilities, n, cutoff)
1359491
def _cover2exprs(inputs, noutputs, cover):
    """"""
    fs = list()
    for i in range(noutputs):
        terms = list()
        for invec, outvec in cover:
            if outvec[i]:
                term = list()
                for j, v in enumerate(inputs):
                    if invec[j] == 1:
                        term.append(~v)
                    elif invec[j] == 2:
                        term.append(v)
                terms.append(term)
        fs.append(Or(*[And(*term) for term in terms]))

    return tuple(fs)
387560
private void keepLowestMatches(final List<Match> matches)
    {
        Set<Match> to_remove = new HashSet<>();
        for (Match match : matches)
        {
            for (Match to_compare : matches)
            {
                if (match.getStartIndex() == to_compare.getStartIndex() && match.getEndIndex() == to_compare.getEndIndex())
                {
                    if (match.calculateEntropy() / match.getLength() > to_compare.calculateEntropy() / to_compare.getLength())
                    {
                        to_remove.add(match);
                        break;
                    }
                }
            }
        }
        matches.removeAll(to_remove);
    }
1359550
public boolean find(int start, MatchResults result) {
        if (!matcher.find(start)) return false;
        applyMatch(result);
        return true;
    }
164661
function addMatchers(sections, tree, resultSections, results, index){
	var hasAll = getChild(tree, WILDCARD_ALL);
	if(hasAll) addValue(resultSections.concat(WILDCARD_ALL), hasAll, results);

	var isEnd = index === sections.length;
	if(isEnd) {
		addValue(resultSections, tree, results);
		return;
	}

	var hasOne = getChild(tree, WILDCARD_ONE);
	if (hasOne) addMatchers(
		sections,
		hasOne,
		resultSections.concat(WILDCARD_ONE),
		results,
		index + 1
	);

	var section = sections[index];
	var hasSection = getChild(tree, section);
	if (hasSection) addMatchers(
		sections,
		hasSection,
		resultSections.concat(section),
		results,
		index + 1
	);
}
586761
public int countMatches() {
		if (null != this.positions && this.positions.isPresent()) {
			return this.positions.get().size();
		}
		
		if (Strs.isEmpty(target4Betn)) {
			return 0;
		}
		
		if (!region.isPresent()) {
			return 0;
		}
		
		if (isEqual(region.get()[0], region.get()[1])) {
			int matchCount = count(target4Betn, region.get()[1]);
			
			if (this.matchWay.get() == 'R' 
					|| this.matchWay.get() == 'L') {
				return matchCount;
			}
			
			matchCount = (matchCount % 2 == 0) ? matchCount : (matchCount - 1);
			return matchCount / 2;
		}
		
		return Math.min(count(target4Betn, region.get()[0]), count(target4Betn, region.get()[1]));
	}
872017
def match(self, pattern):
        """"""

        m = pattern.match(self._string, self._index)
        if m:
            self._index = m.end()
        return m
313737
function findMatchingIndexes(selector, userFields, sortOrder, indexes) {

  return indexes.reduce(function (res, index) {
    var indexMatches = checkIndexMatches(index, sortOrder, userFields, selector);
    if (indexMatches) {
      res.push(index);
    }
    return res;
  }, []);
}
849484
def search(self):
        """"""

        matches = []
        for index, cell in enumerate(self.cells):
            for pattern in Config.patterns:
                if ismatch(cell, pattern):
                    matches.append(index)
                    break

        return matches
729716
def _match_show(self, show):
        """"""
        if self.show:
            return match_list(self.show, show)
        else:
            return True
1242163
def contains(self, x, ctrs, kdtree=None):
        """"""

        return self.overlap(x, ctrs, kdtree=kdtree) > 0
820190
def resolve_using_maximal_coverage(matches):
    
    if len(matches) == 0:
        return matches
    matches.sort()
    N = len(matches)
    scores = [len(match) for match in matches]
    prev = [-1] * N
    for i in range(1, N):
        bestscore = -1
        bestprev = -1
        j = i
        while j >= 0:
            # if matches do not overlap
            if matches[j].is_before(matches[i]):
                l = scores[j] + len(matches[i])
                if l >= bestscore:
                    bestscore = l
                    bestprev = j
            else:
                # in case of overlapping matches
                l = scores[j] - len(matches[j]) + len(matches[i])
                if l >= bestscore:
                    bestscore = l
                    bestprev = prev[j]
            j = j - 1
        scores[i] = bestscore
        prev[i] = bestprev
    # first find the matching with highest combined score
    bestscore = max(scores)
    bestidx = len(scores) - scores[-1::-1].index(bestscore) -1
    # then backtrack the non-conflicting matchings that should be kept
    keepidxs = [bestidx]
    bestidx = prev[bestidx]
    while bestidx != -1:
        keepidxs.append(bestidx)
        bestidx = prev[bestidx]
    # filter the matches
    return [matches[idx] for idx in reversed(keepidxs)]
985511
def find_re(self, pattern):
        """"""
        # TODO: Reduce redundancy with RAFArchive
        pattern = re.compile(pattern, re.I)
        for k, v in six.iteritems(self.entries_full):
            if pattern.search(k):
                # Most recent version will be last
                yield v[-1]
909367
def range_matches(self, other):
        
        return (
            self.begin == other.begin and 
            self.end == other.end
        )
313386
def __matches(s1, s2, ngrams_fn, n=3):
    
    ngrams1, ngrams2 = set(ngrams_fn(s1, n=n)), set(ngrams_fn(s2, n=n))
    return ngrams1.intersection(ngrams2)