Limit output exclusive to user lexicon

Is it possible to limit the output of the SingleLineWidget exclusive to the words of our user lexicon?

We set the user lexicon with

List<String> lexicon = new ArrayList<>();
for (Product product :getProducts()) {
widget.configure("de_DE", "cur_text");

but there are other characters / signs recognized too.

1 Comment

The easiest way to achieve this would be by replacing the default lk file available in the assets folder (.._..-lk-text.lite.res) by a custom lexicon you can compile with the custom resource tool:

How to create and use custom resource file:
- Go to the Resource tools webpage https://developer.myscript.com/tools (it requires to be logged in)
- According to the documentation about lexicon, subset knowledge or math grammar, create your own resource file http://doc.myscript.com/Common/DevTools/index.html. In your case, create a lexicon including only the words you want to recognize (.lk) (You can see and download examples here)
- select 'ATK' and load the file (UTF8 encoded!) then download the generated resource file (.res)

For the SingleLineWidget, please refer to the documentation to see how to configure resources
You can add your own configuration in the .conf file by adding for instance:

Name: test
Type: Text
AddResource en_US/en_US-ak-cur.lite.res
AddResource en_US/test.res
AddResource en_US/en_US-lk-grm.res
SetWordListSize 2

then change the configuration of the widget accordingly:
mWidget.configure("en_US", "test");

Finally, you will be able to see your changes by running your project. Only words from your custom lexicon will be recognized.

Please let us know if you have any other question.
Best regards

Login or Signup to post a comment