diff options
| author | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-24 10:43:55 -0400 |
|---|---|---|
| committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-07-24 10:43:55 -0400 |
| commit | 99ebc483059f5637e0731c9d0b43ddd3d531f2e3 (patch) | |
| tree | 76921e4507782905d38b7b4133cf258cf3f19af6 /src/client/cognitive_services/CognitiveServices.ts | |
| parent | 80493ba3d5e578a37f703b1c0f9e04879c43c134 (diff) | |
wrapped presentation view toggle in an action, cognitive services cleanup
Diffstat (limited to 'src/client/cognitive_services/CognitiveServices.ts')
| -rw-r--r-- | src/client/cognitive_services/CognitiveServices.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/client/cognitive_services/CognitiveServices.ts b/src/client/cognitive_services/CognitiveServices.ts index a778bd47b..dcd27f858 100644 --- a/src/client/cognitive_services/CognitiveServices.ts +++ b/src/client/cognitive_services/CognitiveServices.ts @@ -187,12 +187,15 @@ export namespace CognitiveServices { xhttp.send(body); }; - let results = (await new Promise<any>(requestExecutor)).recognitionUnits; - - target.inkAnalysis = Docs.Get.DocumentHierarchyFromJson(results, "Ink Analysis"); - let recognizedText = results.map((item: any) => item.recognizedText); - let individualWords = recognizedText.filter((text: string) => text && text.split(" ").length === 1); - target.handwriting = individualWords.join(" "); + let results = await new Promise<any>(requestExecutor); + + if (results) { + results.recognitionUnits && (results = results.recognitionUnits); + target.inkAnalysis = Docs.Get.DocumentHierarchyFromJson(results, "Ink Analysis"); + let recognizedText = results.map((item: any) => item.recognizedText); + let individualWords = recognizedText.filter((text: string) => text && text.split(" ").length === 1); + target.handwriting = individualWords.join(" "); + } }); }; |
