- java.lang.Object
-
- com.uddernetworks.newocr.recognition.mergence.MergeRule
-
- Direct Known Subclasses:
ApostropheMergeRule
,EqualVerticalMergeRule
,OverDotMergeRule
,PercentMergeRule
,UnderDotMergeRule
public abstract class MergeRule extends java.lang.Object
Provides methods to combine/merge two character pieces.- Since:
- April 25, 2019
-
-
Field Summary
Fields Modifier and Type Field Description protected DatabaseManager
databaseManager
protected SimilarityManager
similarityManager
-
Constructor Summary
Constructors Constructor Description MergeRule(DatabaseManager databaseManager, SimilarityManager similarityManager)
-
Method Summary
Modifier and Type Method Description abstract MergePriority
getPriority()
Gets the priority of the current ruleabstract boolean
isHorizontal()
Gets if the current merge rule is based on horizontally aligned letters (true) or vertically aligned letters (true).abstract java.util.Optional<java.util.List<ImageLetter>>
mergeCharacters(ImageLetter target, java.util.List<ImageLetter> letterData)
Preforms the merging action with the current rule against the given data.
-
-
-
Field Detail
-
databaseManager
protected DatabaseManager databaseManager
-
similarityManager
protected SimilarityManager similarityManager
-
-
Constructor Detail
-
MergeRule
public MergeRule(DatabaseManager databaseManager, SimilarityManager similarityManager)
-
-
Method Detail
-
isHorizontal
public abstract boolean isHorizontal()
Gets if the current merge rule is based on horizontally aligned letters (true) or vertically aligned letters (true).- Returns:
- If the data given to
mergeCharacters(ImageLetter, List)
is horizontal (Full line) data
-
getPriority
public abstract MergePriority getPriority()
Gets the priority of the current rule- Returns:
- The priority of the rule
-
mergeCharacters
public abstract java.util.Optional<java.util.List<ImageLetter>> mergeCharacters(ImageLetter target, java.util.List<ImageLetter> letterData)
Preforms the merging action with the current rule against the given data. IfisHorizontal()
is true, the given data will be a full line of data. If it returns false, the data will be all characters with a horizontal overlap in a column.- Parameters:
target
- The base charcaterletterData
- The letter data- Returns:
- The
ImageLetter
that should be removed if the merge was successful
-
-