Cloud Development Kit

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


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

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

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 新 雷,

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

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

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

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 and help. It will run perfectly in the future.

Thank you

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

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 write one by one,

The way to do this is type: "addStrokes",

But I have tested it, I am graffiti and will not trigger the delete gesture.

Is it necessary to add some key fields to set each pen?

I see that the way type: 'pointerEvents' and type: "addStrokes" are different.

pointerEvents has settings for processGestures, but addStrokes does not.

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

Hello there,

Sending strokes must be of the same type.

I tried addStrokes in the early days and found that it didn't work.

Trying pointerEvents later, still can't call gestures.

Is it necessary to configure it in the configuration? Or the gesture recognition is turned on by default.

I want to try to implement the following link functions in the cloud server.

Https://developer.myscript.com/docs/concepts/editing-gestures/

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

Login or Signup to post a comment