Interactive Ink

Answered

how to reduce the size of Alphabet Knowledge

I just need to identify numbers, so I created a Subset Knowledge that contains 123456789+-, so which Alphabet Knowledge needs to be added to minimize the size of the identified resources


Best Answer
Dear Sir,

thank you for contacting and your question.

If I understand well, you created a custom Subset Knowledge file to constrain the characters you would like to recognize.

This can be done as follows (I created a digit.res subset knowledge):
-First, copy your compiled subset knowledge into the assets of the language you will be using. In my case, I copy it into the en_US resources directory:
-Then, you shall either add your subset knowledge file to the default configuration, or create a new configuration. In my case, I will create a "textdigits" configuration in the en_US.conf file:

Bundle-Version: 1.0
Bundle-Name: en_US
Configuration-Script:
 AddResDir ../resources/

Name: text
Type: Text
Configuration-Script:
 AddResource en_US/en_US-ak-cur.res
 AddResource en_US/en_US-lk-text.res
 EnableAlienCharacters
 SetTextListSize 1
 SetWordListSize 5
 SetCharListSize 1

Name: textdigits
Type: Text
Configuration-Script:
 AddResource en_US/en_US-ak-cur.res
 AddResource en_US/en_US-lk-text.res
 AddResource en_US/digits.res
 EnableAlienCharacters
 SetTextListSize 1
 SetWordListSize 5
 SetCharListSize 1


-Last, the "textdigits" configuration shall be set when configuring the engine:

    engine = IInkApplication.getEngine();

    // configure recognition
    Configuration conf = engine.getConfiguration();
    String confDir = "zip://" + getPackageCodePath() + "!/assets/conf";
    conf.setStringArray("configuration-manager.search-path", new String[]{confDir});
    String tempDir = getFilesDir().getPath() + File.separator + "tmp";
    conf.setString("content-package.temp-folder", tempDir);
    conf.setString("text.configuration.name", "textdigits");



Let us know if you need any other help.


Best regards,


Olivier


Answer
Dear Sir,

thank you for contacting and your question.

If I understand well, you created a custom Subset Knowledge file to constrain the characters you would like to recognize.

This can be done as follows (I created a digit.res subset knowledge):
-First, copy your compiled subset knowledge into the assets of the language you will be using. In my case, I copy it into the en_US resources directory:
-Then, you shall either add your subset knowledge file to the default configuration, or create a new configuration. In my case, I will create a "textdigits" configuration in the en_US.conf file:

Bundle-Version: 1.0
Bundle-Name: en_US
Configuration-Script:
 AddResDir ../resources/

Name: text
Type: Text
Configuration-Script:
 AddResource en_US/en_US-ak-cur.res
 AddResource en_US/en_US-lk-text.res
 EnableAlienCharacters
 SetTextListSize 1
 SetWordListSize 5
 SetCharListSize 1

Name: textdigits
Type: Text
Configuration-Script:
 AddResource en_US/en_US-ak-cur.res
 AddResource en_US/en_US-lk-text.res
 AddResource en_US/digits.res
 EnableAlienCharacters
 SetTextListSize 1
 SetWordListSize 5
 SetCharListSize 1


-Last, the "textdigits" configuration shall be set when configuring the engine:

    engine = IInkApplication.getEngine();

    // configure recognition
    Configuration conf = engine.getConfiguration();
    String confDir = "zip://" + getPackageCodePath() + "!/assets/conf";
    conf.setStringArray("configuration-manager.search-path", new String[]{confDir});
    String tempDir = getFilesDir().getPath() + File.separator + "tmp";
    conf.setString("content-package.temp-folder", tempDir);
    conf.setString("text.configuration.name", "textdigits");



Let us know if you need any other help.


Best regards,


Olivier

Thanks, but the assets of the language is too large for me, can I just keep the subset knowledge, or which is the smallest language assets?

Dear Sir,


thank you for the update.


Currently, the "ak" resource is mandatory, as it contains all the "intelligence" of a language. A subset knowledge shall be seen as a mask that will only allow few characters of a given language to be recognized.


You then understand there is no way to reduce the size of the resources.


Best regards,


Olivier