Class StringMapper
java.lang.Object
com.itextpdf.pdfocr.onnx.recognition.StringMapper
- All Implemented Interfaces:
-
IOutputLabelMapper<String>
- Direct Known Subclasses:
-
EasyOcrMapper
Look-up table for mapping text recognition model results to strings.
If you only need to map indices to single UTF-16 code units, then consider using Vocabulary instead, as it is much more memory efficient.
-
Constructor Summary
ConstructorsConstructorDescriptionStringMapper(String lookUpString) Creates a new string mapper based on a look-up string.StringMapper(String[] lookUpTable) Creates a new string mapper based on a look-up table. -
Method Summary
-
Constructor Details
-
StringMapper
Creates a new string mapper based on a look-up string. Each code point is mapped to an index.- Parameters:
-
lookUpString- look-up string, that will be used to build a look-up table
-
StringMapper
Creates a new string mapper based on a look-up table.- Parameters:
-
lookUpTable- look-up table to be used in the string mapper
-
-
Method Details
-
size
public int size()Returns the size of the string mapper.- Specified by:
-
sizein interfaceIOutputLabelMapper<String> - Returns:
- the size of the string mapper
-
map
Returns character, which is mapped to the specified index in the lookup string.- Specified by:
-
mapin interfaceIOutputLabelMapper<String> - Parameters:
-
index- index to map - Returns:
- mapped character
-
hashCode
public int hashCode() -
equals
-
toString
-