Last active
February 12, 2020 01:48
-
-
Save duanebester/29f38e6b64328b18d858d52ccf76306b to your computer and use it in GitHub Desktop.
Extract Persons Flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extractPersons = Flow[OcrSuggestions].map(ocr => { | |
val tokens = tokenizer.tokenize(ocr.ocr) | |
val spans:Array[Span] = personFinderME.find(tokens) | |
val persons = spans.toList.map(span => tokens(span.getStart())) | |
OcrSuggestionsPersons(ocr.ocr, ocr.suggestions, persons) | |
}) | |
// Update OCR Flow | |
val ocrFlow = imageOcr.via(spellCheck).via(extractPersons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment