public class DictionaryMatch extends LineSegment implements Comparable<DictionaryMatch>
begin, end
Constructor and Description |
---|
DictionaryMatch(int begin,
int end) |
DictionaryMatch(NodeHandle node,
NodeName name) |
DictionaryMatch(NodeHandle node,
NodeName name,
int begin,
int end,
double probability)
Creates a new instance of DictionaryMatch.
|
DictionaryMatch(NodeHandle node,
NodeName name,
int begin,
int end,
double probability,
LineSegment partialMatch)
Creates a new instance of DictionaryMatch.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DictionaryMatch t)
Allows to sort the matches by their weight.
|
boolean |
equals(Object obj)
Checks whether the two DictionaryMatch instances equal.
|
String |
getName()
Returns the name of the NodeName this match refers to.
|
NodeName |
getNameDescr()
Returns the reference to the NodeName this match refers to.
|
NodeHandle |
getNode()
Returns the reference to the related node.
|
LineSegment |
getPartialMatch()
Returns the partial match position (if any).
|
double |
getProbability()
Returns the match probability as a value between 0.0f and 1.0f
|
double |
getRelativeMatchProbability(int maxCharCount)
Returns the relative match probability (relative to the length of the
complete word).
|
int |
hashCode()
Returns a hash code of the object that depends on the node handle, the
node name and the begin and end.
|
static Collection<DictionaryMatch> |
reduceMatches(String underlyingText,
List<DictionaryMatch> matches)
Removes all overlapping matches to the same node name that only differ in
non-alphanumeric characters.
|
void |
setProbability(double probability)
Sets the probability to the given value.
|
boundariesEqual, boundariesEqual, getBegin, getEnd, intersection, isValid, isValid, length, length, normalize, normalize, normalizedBounds, overlaps, overlaps, setBegin, setEnd, union
public DictionaryMatch(NodeHandle node, NodeName name, int begin, int end, double probability, LineSegment partialMatch)
node
- is a reference to the node the match belongs to.name
- is a reference to the NodeName instance this match refers to.begin
- marks the beginning of the substring in the name this match
refers to.end
- marks the end of the substring in the name this match refers
to.probability
- is the match probability.partialMatch
- if set, this indicates that the dictionary match
refers to a partial word in the reference text. May also be NULL.public DictionaryMatch(NodeHandle node, NodeName name, int begin, int end, double probability)
node
- is a reference to the node the match belongs to.name
- is a reference to the NodeName instance this match refers to.begin
- marks the beginning of the substring in the name this match
refers to.end
- marks the end of the substring in the name this match refers
to.probability
- is the match probability.public DictionaryMatch(NodeHandle node, NodeName name)
public DictionaryMatch(int begin, int end)
public static Collection<DictionaryMatch> reduceMatches(String underlyingText, List<DictionaryMatch> matches)
underlyingText
- specifies the text the positions in the dicrionary
match refer to.matches
- is the list of matches that will be reduced.public NodeHandle getNode()
public NodeName getNameDescr()
public String getName()
public double getProbability()
public void setProbability(double probability)
probability
- public double getRelativeMatchProbability(int maxCharCount)
maxCharCount
- is the maximum character count that should be used
for the calculation.public LineSegment getPartialMatch()
public int compareTo(DictionaryMatch t)
compareTo
in interface Comparable<DictionaryMatch>
t
- the match this match should be compared to.public boolean equals(Object obj)
Copyright (C) 2013, 2014 Raphael Dickfelder, Jan Göpfert, Benjamin Paassen, Andreas Stöckel, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/scie