react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
70 lines (63 loc) • 2 kB
JavaScript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/textpattern/TextPatternScannerUIResult.yaml
import { SymbolBox, WordBox } from '../../text_pattern_scanner/TextPatternScannerTypes';
import { ToJsonConfiguration } from '../../utils/json/JsonSerializationTypes';
import { PartiallyConstructible } from '../../utils/utils';
/**
Configuration of the generic text scanner RTU UI result.
*/
export class TextPatternScannerUiResult extends PartiallyConstructible {
/**
Raw recognized string.
*/
/**
Boxes for each recognized word.
*/
/**
Boxes for each recognized symbol.
*/
/**
Confidence of the recognition.
Default is 0.0
*/
confidence = 0.0;
/** @param source {@displayType `DeepPartial<TextPatternScannerUiResult>`} */
constructor(source = {}) {
super();
if (source.rawText !== undefined) {
this.rawText = source.rawText;
} else {
throw new Error('rawText must be present in constructor argument');
}
if (source.wordBoxes !== undefined) {
this.wordBoxes = source.wordBoxes.map(it => {
return new WordBox(it);
});
} else {
throw new Error('wordBoxes must be present in constructor argument');
}
if (source.symbolBoxes !== undefined) {
this.symbolBoxes = source.symbolBoxes.map(it => {
return new SymbolBox(it);
});
} else {
throw new Error('symbolBoxes must be present in constructor argument');
}
if (source.confidence !== undefined) {
this.confidence = source.confidence;
}
}
serialize(config = new ToJsonConfiguration()) {
return {
rawText: this.rawText,
wordBoxes: this.wordBoxes.map(it => {
return it.serialize(config);
}),
symbolBoxes: this.symbolBoxes.map(it => {
return it.serialize(config);
}),
confidence: this.confidence
};
}
}
//# sourceMappingURL=TextPatternScannerUIResult.js.map