- java.lang.Object
-
- com.uddernetworks.newocr.recognition.mergence.DefaultMergenceManager
-
- All Implemented Interfaces:
MergenceManager
public class DefaultMergenceManager extends java.lang.Object implements MergenceManager
Merges character pieces together.- Since:
- April 25, 2019
-
-
Constructor Summary
Constructors Constructor Description DefaultMergenceManager(DatabaseManager databaseManager, SimilarityManager similarityManager)
Creates a newDefaultMergenceManager
.
-
Method Summary
Modifier and Type Method Description MergenceManager
addRule(java.util.function.BiFunction<DatabaseManager,SimilarityManager,MergeRule> rule)
Adds a mergence rule to be ran using the givenDatabaseManager
andSimilarityManager
from the constructor.void
beginMergence(it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap<java.util.List<ImageLetter>> sortedLines, SimilarityManager similarityManager)
Orders and invokes all merge rules'MergeRule.mergeCharacters(ImageLetter, List)
method with appropriate data.MergenceManager
loadDefaults()
Adds the defaultMergeRule
s, otherwise all rules will need to be added manually viaMergenceManager.addRule(BiFunction)
.
-
-
-
Constructor Detail
-
DefaultMergenceManager
public DefaultMergenceManager(DatabaseManager databaseManager, SimilarityManager similarityManager)
Creates a newDefaultMergenceManager
.- Parameters:
databaseManager
- TheDatabaseManager
to usesimilarityManager
- TheSimilarityManager
to use
-
-
Method Detail
-
loadDefaults
public MergenceManager loadDefaults()
Adds the defaultMergeRule
s, otherwise all rules will need to be added manually viaMergenceManager.addRule(BiFunction)
.- Returns:
- The current
MergenceManager
-
addRule
public MergenceManager addRule(java.util.function.BiFunction<DatabaseManager,SimilarityManager,MergeRule> rule)
Description copied from interface:MergenceManager
Adds a mergence rule to be ran using the givenDatabaseManager
andSimilarityManager
from the constructor.- Specified by:
addRule
in interfaceMergenceManager
- Parameters:
rule
- The rule to add- Returns:
- The current
MergenceManager
-
beginMergence
public void beginMergence(it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap<java.util.List<ImageLetter>> sortedLines, SimilarityManager similarityManager)
Description copied from interface:MergenceManager
Orders and invokes all merge rules'MergeRule.mergeCharacters(ImageLetter, List)
method with appropriate data.- Specified by:
beginMergence
in interfaceMergenceManager
- Parameters:
sortedLines
- The read image datasimilarityManager
- TheSimilarityManager
used
-
-