Class AmountParser
java.lang.Object
com.microblink.photopay.entities.Entity<T>
com.microblink.photopay.entities.parsers.Parser<AmountParser.Result>
com.microblink.photopay.entities.parsers.amount.AmountParser
- All Implemented Interfaces:
android.os.Parcelable
A parser that can extract amounts from OCR result.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.microblink.photopay.entities.parsers.Parser
CLASS_NAME
Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears parser result.clone()
Create a copy of the entity.void
consumeResult
(AmountParser.Result resultToConsume) Consumes given result.void
consumeResultFrom
(Entity other) Consume result from other entity.protected void
deserializeNativeSettings
(byte[] serializedSettings) boolean
Indicates whether Arabic-Indic mode is enabled.protected byte[]
void
setAllowMissingDecimals
(boolean allowMissingDecimals) Indicates whether amounts without decimal are accepted as valid.void
setAllowNegativeAmounts
(boolean allowNegativeAmounts) Indicates whether negative values are accepted as valid amounts.void
setAllowSpaceSeparators
(boolean allowSpaceSeparators) Indicates whether amounts with space separators between groups of digits(thousands) are allowed.void
setArabicIndicMode
(boolean arabicIndicMode) Indicates whether Arabic-Indic mode is enabled.boolean
Indicates whether amounts without decimal are accepted as valid.boolean
Indicates whether negative values are accepted as valid amounts.boolean
Indicates whether amounts with space separators between groups of digits(thousands) are allowed.protected void
terminateNative
(long nativeContext) Methods inherited from class com.microblink.photopay.entities.parsers.Parser
getPriority, isRequired, setRequired
Methods inherited from class com.microblink.photopay.entities.Entity
describeContents, finalize, getNativeContext, getResult, nativeGetNativeResultContext, readFromParcel, writeToParcel
-
Field Details
-
CREATOR
-
-
Constructor Details
-
AmountParser
public AmountParser()
-
-
Method Details
-
setAllowSpaceSeparators
public void setAllowSpaceSeparators(boolean allowSpaceSeparators) Indicates whether amounts with space separators between groups of digits(thousands) are allowed. By default, this is set to 'false' -
shouldAllowSpaceSeparators
public boolean shouldAllowSpaceSeparators()Indicates whether amounts with space separators between groups of digits(thousands) are allowed. By default, this is set to 'false' -
setAllowMissingDecimals
public void setAllowMissingDecimals(boolean allowMissingDecimals) Indicates whether amounts without decimal are accepted as valid. For example 1.465 is accepted as valid amount, but 1465 is not, unless this is set totrue
. Setting this totrue
can yield to more false positives because any set of consequent digits can represent valid amount. By default, this is set to 'false' -
shouldAllowMissingDecimals
public boolean shouldAllowMissingDecimals()Indicates whether amounts without decimal are accepted as valid. For example 1.465 is accepted as valid amount, but 1465 is not, unless this is set totrue
. Setting this totrue
can yield to more false positives because any set of consequent digits can represent valid amount. By default, this is set to 'false' -
setArabicIndicMode
public void setArabicIndicMode(boolean arabicIndicMode) Indicates whether Arabic-Indic mode is enabled. In Arabic-Indic mode parser can recognize only amounts which consist of Arabic-Indic digits and decimal separator. By default, this is set to 'false' -
isArabicIndicMode
public boolean isArabicIndicMode()Indicates whether Arabic-Indic mode is enabled. In Arabic-Indic mode parser can recognize only amounts which consist of Arabic-Indic digits and decimal separator. By default, this is set to 'false' -
setAllowNegativeAmounts
public void setAllowNegativeAmounts(boolean allowNegativeAmounts) Indicates whether negative values are accepted as valid amounts. Setting this totrue
can yield to more false positives. By default, this is set to 'false' -
shouldAllowNegativeAmounts
public boolean shouldAllowNegativeAmounts()Indicates whether negative values are accepted as valid amounts. Setting this totrue
can yield to more false positives. By default, this is set to 'false' -
terminateNative
protected void terminateNative(long nativeContext) - Specified by:
terminateNative
in classEntity<AmountParser.Result>
-
serializeNativeSettings
@Nullable protected byte[] serializeNativeSettings()- Specified by:
serializeNativeSettings
in classEntity<AmountParser.Result>
-
deserializeNativeSettings
protected void deserializeNativeSettings(@NonNull byte[] serializedSettings) - Specified by:
deserializeNativeSettings
in classEntity<AmountParser.Result>
-
clone
Description copied from class:Entity
Create a copy of the entity. This is required if properties of the entity must be modified while background thread performs processing. In order to avoid race conditions, changing properties is not allowed while entity is used in background processing. However, you are able to make a copy of the entity, change properties of it and then update theRecognizerRunnerView
orRecognizerRunner
with the updated entity hierarchy.- Specified by:
clone
in classEntity<AmountParser.Result>
- Returns:
- a copy of the entity
-
consumeResultFrom
Description copied from class:Entity
Consume result from other entity. The result from other will be put instead current result of this entity. This method is used insideBaseIntentTransferable.loadFromIntent(Intent)
and similar methods to replace the result content of the saved entities with results that have arrived overIntent
- Specified by:
consumeResultFrom
in classEntity<AmountParser.Result>
- Parameters:
other
- Entity from which result should be consumed.
-
consumeResult
Description copied from class:Parser
Consumes given result. The given result will be put instead current result of this entity.- Specified by:
consumeResult
in classParser<AmountParser.Result>
- Parameters:
resultToConsume
- Result that should be consumed.
-
clearResult
public void clearResult()Description copied from class:Parser
Clears parser result.- Specified by:
clearResult
in classParser<AmountParser.Result>
-