UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

103 lines (88 loc) 3.8 kB
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten. /// Generated from core/schemas/FrameAccumulationTypes.yaml import { DeepPartial, PartiallyConstructible } from '../utils/utils'; /** Method used to confirm a result. - `EXACT`: Require seeing the same result multiple times to confirm it. E.g. if the seen values are "John B. Doe", "John B.", "B. Doe", "John B. Doe" then the confirmation count for the value "John B. Doe" is 2 and for the rest it's 1. A field's value is considered CONFIRMED if its confirmation count is greater or equal to minConfirmations. - `INTERPOLATE`: Interpolate between seen values to generate the most likely true value. E.g. if the seen values are "John X. Doe", "John B.", "B. Doe" then the most likely true value can be interpolated to be "John B. Doe". The interpolated value is considered CONFIRMED if each character in it has been seen at least minConfirmations times. */ export type ConfirmationMethod = 'EXACT' | 'INTERPOLATE'; export const ConfirmationMethodValues: ConfirmationMethod[] = ['EXACT', 'INTERPOLATE']; /** Configuration for how to accumulate results. */ export class ResultAccumulationConfiguration extends PartiallyConstructible { /** Method used to confirm a result. Default is EXACT */ public confirmationMethod: ConfirmationMethod = 'EXACT'; /** Number of confirmations required to consider a result confirmed (see ConfirmationMethod). Requiring more confirmations will increase the reliability of the result but also the time to gather enough confirmations. Default is 3 */ public minConfirmations: number = 3; /** Minimum confidence required to consider a field confirmed. Default is 0.8 */ public minConfidenceForStableField: number = 0.8; /** Will auto-clear the cache if this number of frames have been a different document type or empty. Default is 4 */ public autoClearThreshold: number = 4; /** @param source {@displayType `DeepPartial<ResultAccumulationConfiguration>`} */ public constructor(source: DeepPartial<ResultAccumulationConfiguration> = {}) { super(); if (source.confirmationMethod !== undefined) { this.confirmationMethod = source.confirmationMethod; } if (source.minConfirmations !== undefined) { this.minConfirmations = source.minConfirmations; } if (source.minConfidenceForStableField !== undefined) { this.minConfidenceForStableField = source.minConfidenceForStableField; } if (source.autoClearThreshold !== undefined) { this.autoClearThreshold = source.autoClearThreshold; } } } /** Configure the frame accumulation process. */ export class AccumulatedResultsVerifierConfiguration extends PartiallyConstructible { /** Maximum number of accumulated frames to inspect to verify a scan result. Default is 3 */ public maximumNumberOfAccumulatedFrames: number = 3; /** Minimum number of accumulated frames that have an equal result in order for the result to be considered verified. Default is 2 */ public minimumNumberOfRequiredFramesWithEqualScanningResult: number = 2; /** @param source {@displayType `DeepPartial<AccumulatedResultsVerifierConfiguration>`} */ public constructor(source: DeepPartial<AccumulatedResultsVerifierConfiguration> = {}) { super(); if (source.maximumNumberOfAccumulatedFrames !== undefined) { this.maximumNumberOfAccumulatedFrames = source.maximumNumberOfAccumulatedFrames; } if (source.minimumNumberOfRequiredFramesWithEqualScanningResult !== undefined) { this.minimumNumberOfRequiredFramesWithEqualScanningResult = source.minimumNumberOfRequiredFramesWithEqualScanningResult; } } }