iink SDK Web

Answered

About Android environment integration cloud recognition.

发送   newContentPackager

返回类型确认 

发送   {

 “ type” “ newContentPart” 
 “ contentType” “ MATH” “ mimeTypes” :[ “ application / x-latex” “ application / mathml + xml” }  
发送配置 
发送 {

 类型“ addStrokes”  

 笔画“ id” 'pending-1' “ pointerType     
“  
 'PEN' “×” 273 278 281 ],“Y” 121 128       
133 ],“ t”    
3185.7900000000004 3 
213.8150000000005 3222.5350000000003 ],“P” 1.3 1.3 1.3 }        
系统返回给我“ 键入错误消息,当前内容无内容   

我想知道Android是否不能使用WebSockets或为什么 



Best Answer

Dear 新 雷,


Thank you for your update.


In the configuration of your code sample, you should make following changes:


  1. The configuration message must be sent before creating the part, else the configuration is not applied to the new part. So you must move your configuration block code before your contentpart block code.
  2. In your configuration json there is a small mistake on the language key name: it must be "lang" (not "language"). So in your code the line "\"language\":\"zh_CN\",\n"+must be replaced by "\"lang\":\"zh_CN\",\n" +



With those updates, the strokes are recognized as 干as you expect.


Regards,

 

Gwenaëlle


Dear XiangJue,


I recomment you play with the webDemo and look for the messages in the console: https://webdemo.myscript.com/views/text/index.html


Doing an erasure I had the following message:

{"type":"svgPatch","updates":[
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "REMOVE_CHILD", "parentId": "BACKGROUND-guides", "index": 0 },
{ "type": "SET_ATTRIBUTE", "name": "viewBox", "value": "0 0 1920 100 " },
{ "type": "SET_ATTRIBUTE", "name": "height", "value": "100px" }
],"layer":"BACKGROUND"}


Applying all the SVG patches should normally update properly your background.


Best regards,


Olivier

Dear XiangJue,


can you confirm you apply SVG Patch, which will allow you to remove the erased stroke: https://developer.myscript.com/docs/interactive-ink/1.3/web/websockets/messages/#pending-stroke-management


Let us know if this helps.


Best regards,


Olivier

Dear XiangJue,


Currently, I am not sure to understand.


Is it possible to have the different types of requests your are sending to our server? This will help understand.


Thank you,


Best regards,


Olivier

Dear 新 雷,


Currently, how do you add your strokes? In batch mode (all strokes at once), or as soon as they are written? Indeed, in the latter case, gestures are normally set and detected when written. Otherwise, in batch mode these are indeed not activated.


Best regards,


Olivier

I have a new problem recently,

I wanted to turn on gesture erasure, but I didn't find any cloud recognition gestures,

Although pointerevents has a hint,

But when I transplanted it, it didn't seem to work out

Although pointerevents has a little hint, it seems that there is no result after I transplant it in

Thank you very much for your patience and help. It will run perfectly in the future.

Thank you

Answer

Dear 新 雷,


Thank you for your update.


In the configuration of your code sample, you should make following changes:


  1. The configuration message must be sent before creating the part, else the configuration is not applied to the new part. So you must move your configuration block code before your contentpart block code.
  2. In your configuration json there is a small mistake on the language key name: it must be "lang" (not "language"). So in your code the line "\"language\":\"zh_CN\",\n"+must be replaced by "\"lang\":\"zh_CN\",\n" +



With those updates, the strokes are recognized as 干as you expect.


Regards,

 

Gwenaëlle


1 person likes this

Thank you very much for your patience

demo This is the instance code you want

The internal code is very simple. The basic configuration is made, and the language is changed to Chinese.

But I'm very sad that I can't recognize Chinese all the time.

The strokes I added are from file:///D:/web-integration-samples-master/batch-mode-explorer/dist/index.html#/write

This is my input: 干,

You can also take my configuration and test it

Dear 新 雷,

Currently, I changed language using the samples available at the following location: https://myscript.github.io/myscript-text-web/#/elements/myscript-text-web/demos/other-examples

Under Chrome, using the inspector, I have the following message when switching to the cs_CZ language:
{
"type":"configuration",
"alwaysConnected":false,
"lang":"cs_CZ",
"text":{
"guides":{"enable":true},
"smartGuide":true,
"smartGuideFadeOut":{"enable":false,"duration":10000,"enabled":false},
"mimeTypes":["text/plain","application/vnd.myscript.jiix"],
"margin":{"top":20,"left":10,"right":10},
"configuration":{"customResources":[],"customLexicon":[],"addLKText":true}}
}

Comparing with your message, the only difference I see that you replaced "guides" with "guides":
{
"type":"configuration",
"lang":"zh_CN",
"text":{
"margin":{"top":0,"left":0,"right":0},
"guide":{"enable":true},
"configuration":{"addLKText":true}
}
}

Can you please check this?


Let us know if it helps.


Best regards,

Olivier


1 person likes this

Dear 新 雷,

thank you for the update.

Based on the above, your language configuration of the webSocket seems fines. It is indeed similar to the documentation: https://developer.myscript.com/docs/interactive-ink/1.3/web/websockets/messages/#configuration


Which ink are you sending? Can we have the X and Y coordinates.

Is it possible to have your code, so that we can investigate further?

Best regards,

Olivier


1 person likes this

Hello,The above problem is solved because of the problem of JSON format,

I want to ask a new question,I set it up in configuration

{

    "type":"configuration",

    "lang":"zh_CN",

    "math":{

        "solver":{

            "enable":true,

            "fractionalPartDigits":3,

            "decimalSeparator":".",

            "roundingMode":"half up",

            "angleUnit":"deg"

        },

        "margin":{

            "top":0,

            "left":0,

            "right":0

        },

    },

    "text":{

        "margin":{

            "top":0,

            "left":0,

            "right":0

        },

        "guide":{

            "enable":true

        },

        "configuration":{

            "addLKText":true

        }

    }

}

 

After the submission of the strokes, all of them can be identified in English, but not in Chinese.

I've changed the language. Why doesn't it take effect?

if possible,

Can you give me a simple Chinese recognition configuration?

Dear Sir,


thank you for contacting us.


First, there is no reason webSocket cannot be done on Android.


On your side, can you confirm you get the "partChanged" event before sending the configuration and strokes?


Best regards,


Olivier

send   newContentPackager

return "type ack"

send{

“ type” “ newContentPart”

“ contentType” “ MATH” “ mimeTypes” :[ “ application / x-latex” “ application / mathml + xml” ] }

send configuration

send {

 {

type: "addStrokes",

strokes: [

{ "id": 'pending-1', "pointerType" : 'PEN', "x": [273, 278, 281], "y": [121, 128, 133], "t": [3185.7900000000004, 3213.8150000000005, 3222.5350000000003], "p": [1.3, 1.3, 1.3] } ] }

The system returned to me "type error message, no content part curent found

I wonder if Android can't use WebSockets or why