iink SDK on Device

Answered

Possibility to support 2 languages by having 2 engines simultaneously.

Hello, our customer is asking if the following scenario would be possible. The background for the question is that the app mainly does handwrting recognition in Japanese, but there might be some parts in English and the recognition of English is not so good with the engine configured for Japanese.

So they would like to know if a method that looks like the following could be used to improve English recognition.

1) Have an engine in Japanese running in the foreground and another engine in English running in the background (I notice that the sample code uses a singleton for the engine, so I don't know if overriding the singleton implementation and running 2 engines simultaneously would cause problems).

2) Capture the pen stroke data in the foreground.

3) Pass the pen stroke data to the background engine.

4) Connect the conversion results from the background engine to the foreground.

* We understand that it would probably not be possible to achieve real-time recognition with this scenario.

Sorry for the complicated questions, but we would really like to be able to achieve good recognition for both English and Japanese at the same time.

Thanks!


Best Answer

Dear Nicolas,

thank you for contacting us.

Indeed you are right, the engine is a singleton. The solution is pretty straightforward, as it consists in creating 2 editors, and set the language configuration at editor level for each editor, and NOT at the engine level.

This can be done as follows:

private Editor editor_en_US;
private Editor editor_ja_JP;
...


editor_en_US = engine.createEditor(renderer);
editor_ja_JP = engine.createEditor(renderer);

Configuration conf_Editor_en_US = editor_en_US.getConfiguration();
Configuration conf_Editor_ja_JP = editor_ja_JP.getConfiguration();

conf_Editor_en_US.setString("lang", "en_US");
conf_Editor_en_US.setString("lang", "ja_JP");



You can then add the strokes for each editor, and process with the recognition. After export, you will then have recognition in English and Japanese on the proper editor.

Let us know if this helps.

Best regards,

Olivier


Answer

Dear Nicolas,

thank you for contacting us.

Indeed you are right, the engine is a singleton. The solution is pretty straightforward, as it consists in creating 2 editors, and set the language configuration at editor level for each editor, and NOT at the engine level.

This can be done as follows:

private Editor editor_en_US;
private Editor editor_ja_JP;
...


editor_en_US = engine.createEditor(renderer);
editor_ja_JP = engine.createEditor(renderer);

Configuration conf_Editor_en_US = editor_en_US.getConfiguration();
Configuration conf_Editor_ja_JP = editor_ja_JP.getConfiguration();

conf_Editor_en_US.setString("lang", "en_US");
conf_Editor_en_US.setString("lang", "ja_JP");



You can then add the strokes for each editor, and process with the recognition. After export, you will then have recognition in English and Japanese on the proper editor.

Let us know if this helps.

Best regards,

Olivier


1 person likes this

Hi Olivier.

Thank you for your reply. It looks like this could help us achieve our goal, but we would like to confirm that the following is possible.

We would create 2 editors. 1 in Japanese and 1 in English.

We would display the Japanese editor where the user would input strokes.

We then pass the stroke data to the English editor (not displayed).

We get the conversion result from the English editor and pass it back to the Japanese editor.

Would that work? And is there a sample available that does something similar?

Thanks!

P.S. Is it better if I post follow up questions like this as a new thread/topic?

Dear Nicolas,


thank you for the update.


Currently, there is no reason you could not proceed this way.


The easier is that you export your English editor as text ; you can proceed as follows:

        try{
          editor_en_US.waitForIdle();
          String en_USExport= editor_en_US.export_(null, MimeType.TEXT);
          editor_ja_JP.import_(MimeType.TEXT, en_USExport,null);
        }
        catch (Exception e)
        {

        }


P.S. Is it better if I post follow up questions like this as a new thread/topic?

>>As there is a relation, with your first question, you can continue in this thread.


Best regards,


Olivier


						

1 person likes this