AI-generated Key Takeaways
-
RecognitionContext provides information about the context in which ink has been drawn to improve recognition quality when passed to a DigitalInkRecognizer.
-
The builder method is used to return the final RecognitionContext object.
-
getPreContext provides characters immediately before the insertion point of recognized text, aiding in disambiguation, with a recommended length of up to around 20 characters.
-
getWritingArea provides the size of the writing area, which is used by some models for disambiguation like differentiating between lowercase and uppercase characters.
Information about the context in which an ink has been drawn.
Pass this object to a
DigitalInkRecognizer alongside an ink to improve the recognition quality.
Nested Class Summary
| class | RecognitionContext.Builder | Builder for the
RecognitionContext class. |
|
Public Constructor Summary
Public Method Summary
| static RecognitionContext.Builder |
builder()
Returns the final
RecognitionContext object.
|
| abstract String |
getPreContext()
Characters immediately before the position where the recognized text should be
inserted.
|
| abstract WritingArea |
getWritingArea()
Size of the writing area.
|
Inherited Method Summary
Public Constructors
public RecognitionContext ()
Public Methods
public static RecognitionContext.Builder builder ()
Returns the final
RecognitionContext object.
public abstract String getPreContext ()
Characters immediately before the position where the recognized text should be inserted.
Example: a text field contains "hello", with the cursor right after "o". The user handwrites something that looks like "world". If the pre-context is set to "hello", the recognition model will be able to output " world", with a leading space.
If the text field contain "hello" with the cursor between "e" and the first "l", then the pre-context must be set to "he".
A good rule of thumb for pre-context length is: as many characters as possible, including spaces, until around 20. The optimal number depends on the exact recognition model that is used. Getting the best speed/accuracy tradeoff may require a bit of tuning.
public abstract WritingArea getWritingArea ()
Size of the writing area.
This is used by some recognition models for disambiguation. Example: lowercase vs uppercase ("o" vs "O") .
See also WritingArea.