iink SDK Web

Answered

customLexicon option v4

Hi,

I want a response as a combination of custom lexicon and general text (non-stringent).

It is either giving all words from custom lexicon (stringent) or not even a single one from lexicon.
1. The following request gives all words from lexicon:-

{

        "contentType": "Raw Content",

        "strokeGroups": [{"strokes": strokes}],

        "configuration": {

            "lang": "en_US",

            "raw-content": {

                "recognition": {

                    "text": True

                },

                "text": {

                    "customLexicon": lexicon,

                    "addLKText": False

                }

            }

        }

    }

2. The following request gives no word from lexicon:-

{

        "contentType": "Text",

        "strokeGroups": [{"strokes": strokes}],

        "configuration": {

            "lang": "en_US",

            "raw-content": {

                "recognition": {

                    "text": True

                },

                "text": {

                    "customLexicon": lexicon,

                    "addLKText": False

                }

            }

        }

    }


The difference is just of "contentType". Please let me know what am I doing wrong.

Thanks!


Best Answer

Dear Keshav,

thank you for contacting us.

First, I am questioning the reason you are using the "raw-content"? Is there a reason rather than using "Text"? Are you recognizing Text mixed with non-text (e.g. shapes), or only Text? In that latter case, instead I recommend you use only Text.

Regarding your requests, there are indeed issues in these:
-First, if you want to recognize custom lexicon and general text, you shall allow the LK-Text, which is done setting "addLKText": True.
-Second, you are not setting your resource properly. Indeed, let's say you name your lexicon "MYLEX", you shall then set it using "customResources" as follows: "customResources": ["MYLEX"] (customLexicon is to add words, e.g. -"customLexicon":["word1", "word2"])
=>The text configuration shall then be set as follows:

"text": {
"customResources": ["MYLEX"],
"addLKText": True
}

You can find all the necessary information on both following links:
-https://developer.myscript.com/docs/interactive-ink/1.4/web/reference/configuration-rest/
-https://swaggerui.myscript.com/

Best regards,

Olivier

1 Comment

Answer

Dear Keshav,

thank you for contacting us.

First, I am questioning the reason you are using the "raw-content"? Is there a reason rather than using "Text"? Are you recognizing Text mixed with non-text (e.g. shapes), or only Text? In that latter case, instead I recommend you use only Text.

Regarding your requests, there are indeed issues in these:
-First, if you want to recognize custom lexicon and general text, you shall allow the LK-Text, which is done setting "addLKText": True.
-Second, you are not setting your resource properly. Indeed, let's say you name your lexicon "MYLEX", you shall then set it using "customResources" as follows: "customResources": ["MYLEX"] (customLexicon is to add words, e.g. -"customLexicon":["word1", "word2"])
=>The text configuration shall then be set as follows:

"text": {
"customResources": ["MYLEX"],
"addLKText": True
}

You can find all the necessary information on both following links:
-https://developer.myscript.com/docs/interactive-ink/1.4/web/reference/configuration-rest/
-https://swaggerui.myscript.com/

Best regards,

Olivier


1 person likes this