Class WeightedContextMatcher

Create a new WeightedContextMatcher instance implementing the fuzzy matching mechanism.

Constructor

class WeightedContextMatcher(radius)
Arguments:
  • radius
    Maximum radius of the fingerprint. Values greater than
    four are not recommended.

Methods

equal

WeightedContextMatcher#equal(subject, offset, value, flag)
Arguments:
  • subject
  • offset
  • value
  • flag

Return true if subject at offset is equal to the candidate value. Override this method if your values need special handling.

matchContent

WeightedContextMatcher#matchContent(subject, offset, flag)
Arguments:
  • subject
  • offset
  • flag

Return 1 if every body-item of the pattern matches the candidates exactly. Otherwise return 0.

matchContext

WeightedContextMatcher#matchContext(subject, offset, flag)
Arguments:
  • subject
  • offset
  • flag

Return a number between 0 and 1 representing the match quality of the pattern context with the candidate.

matchQuality

WeightedContextMatcher#matchQuality(offset, offset, contentflag, contextflag)
Arguments:
  • offset – An integer representing the offset to the subject.
  • offset
  • contentflag
  • contextflag

Return a number between zero and one representing the match quality of the pattern.

setPattern

WeightedContextMatcher#setPattern(body, head, tail)
Arguments:
  • body – Array of context elements between head and tail
  • head – Array of leading context elements
  • tail – Array of trailing context elements

Set the pattern consisting of the body and the context which should be matched against candidates using matchQuality method subsequently.

Table Of Contents

Previous topic

Context Matcher

Next topic

Resolver