Text

Answered

Custom resource file detection

Hello Team,

We have two resource files one is provided by MyScript "en_US-lk-text.res"  and other is "myResource.res" our custom resource file.

We have a word " Brijesh " in our custom resource file.

Now when we write "Brijesh" it is recognised as "British".

Our questions are :

1. Why is it not recognising correctly while we have that word in our custom resource file?

2. If it finds a match in MyScript resource file then will it also try to find a match in our custom resource file?

Regards,

Pankaj Tyagi


 





Best Answer

Dear Pankaj Tyagi,

Thank you for your update.
I recommand you checking four following points:

1/ In your . conf file, for the resources directories, please set both:

AddResDir ../resources/
AddResDir /data/user/0/com.sample/app_sample


2/ Check that your .res file is actually in the right folder: /data/user/0/com.sample/app_sample

3/ If you want to perform some dynamic configuration, please make sure to update the configuration before setting the part on your editor.
You can refer to following post for further details (https://developer-support.myscript.com/support/discussions/topics/16000026598)


4/ Before building an running again your applicaiton, perform first a "clean" project


If it still does not work, please tell us what does not work, and check if you don't have a Bundle not found or other error message in the application log, and share with us the message.

Best regards,

Gwenaëlle


Answer

Dear Pankaj Tyagi,

Thank you for your update.
I recommand you checking four following points:

1/ In your . conf file, for the resources directories, please set both:

AddResDir ../resources/
AddResDir /data/user/0/com.sample/app_sample


2/ Check that your .res file is actually in the right folder: /data/user/0/com.sample/app_sample

3/ If you want to perform some dynamic configuration, please make sure to update the configuration before setting the part on your editor.
You can refer to following post for further details (https://developer-support.myscript.com/support/discussions/topics/16000026598)


4/ Before building an running again your applicaiton, perform first a "clean" project


If it still does not work, please tell us what does not work, and check if you don't have a Bundle not found or other error message in the application log, and share with us the message.

Best regards,

Gwenaëlle

Dear Gwenaëlle,

I am doing all what you suggests.

Below is code of config File.  

Bundle-Version: 1.0
Bundle-Name: en_US
Configuration-Script:
 AddResDir /data/user/0/com.sample/app_sample

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

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

  First we set configuration  string as :

  

 conf.setString("text.configuration.name","configuration1");

After adding word and generate resource file dynamically we set configuration string as :

 

 conf.setString("text.configuration.name","configuration2");

Regards,

Pankaj Tyagi 

Dear Pankaj Tyagi,


Thank you for your request.


If you want to add a lexicon containing the word "Brijesh", you indeed have to build a custom resource file.

So first step is indeed to write a file name something.lex then generate the corresponding .res file, for instance  "myResource.res" 


Then you have to modifiy your engine configuration to use this new resource.

As far as I understand your use case, you would like to add this lexicon to the english US dictionnary.

I suspect this step is missing in your project.


This can be achieved by modifying the en_US.conf file.


You could add following block:


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



Then make sure to copy your myResource.res file into your resources folder in a subfolder named MyResources


Last in your application, configure your engine to use your customized Text configuration:


    Configuration conf = engine.getConfiguration();
    conf.setString("text.configuration.name","textwithMyResource");



After rebuilding your application, it should be able to recognize the word Brijesh


Best regards,


Gwenaëlle