Skip to content

Commit

Permalink
Issue #26: OCR 2nd Pass Guided by User (WIP)
Browse files Browse the repository at this point in the history
It seems we have a good hook set up, now to implement the second pass
  • Loading branch information
seandenigris committed Oct 29, 2020
1 parent a9314ee commit 2596686
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/ResourcesLive-GToolkit/RlhOCRElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ RlhOCRElement >> addShortcuts [
build.
shortcut := BlShortcut new
combination: keyCombo;
action: [ :anEvent :aShortcut |
self client
write: (desc fromString: self selectedText)
using: desc. ].
action: [ :anEvent :aShortcut | self applySelectedTextTo: desc ];
yourself.
self addShortcut: shortcut ]
]

Expand All @@ -57,6 +55,18 @@ RlhOCRElement >> add_hOCR [
self addEventHandler: self selectionHandler
]

{ #category : #accessing }
RlhOCRElement >> applySelectedTextTo: desc [
"Adaptation of MADescription>>#validate:, which is the main access point to validation i.e. all roads (e.g. mementos, forms) ultimately end up here. We're partially reimplementing instead of sending it ourselves because Magritte does not seem to really be set up to interact with element descriptions individually, but through their containers. In this case, the container supplies the proper validator for the domain object"

[ self client magritteDescription validator
on: (desc fromString: self selectedText)
description: desc ]
on: MAError
do: [ Halt now. "Try to OCR again based on desc" ].
self client write: (desc fromString: self selectedText) using: desc
]

{ #category : #accessing }
RlhOCRElement >> client [
^ client
Expand Down

0 comments on commit 2596686

Please sign in to comment.