# Text error correction
This interface, from the plug-in 1.1.3 Start Support
Text error correction. The input is a sentence, the output is the wrong word of the position And the words corrected. Examples: Enter: We Go to School Small School Output: "pos": 4, "corrections": school tip: pos The subscript of the 0 The beginning
# to initialize
Plugin version number in the document, only for example reference, the latest version of the plugin,Subject to this
{
"pages": [
"pages/index/index"
],
"plugins": {
"chatbot": {
"version": "1.2.23",
"provider": "wx8c631f7e9f2465e1"
}
},
"requiredBackgroundModes": [
"audio"
],
"sitemapLocation": "sitemap.json"
}
var plugin = requirePlugin("chatbot")
App({
onLaunch: function () {
plugin.init({
appid: "P5Ot9PHJDechCYqDFAW1AiK6OtG3Ja", //Mini Program sample account, for learning and reference only
openid: "", //User's openid, not required, it is recommended to pass this parameter
success: () => {}, //Not required
fail: (error) => {}, //Not required
})
},
})
# Call Text Error Correction Interface
const txt = "Let's go to school."
plugin.api.gec(txt).then((nothing) => {
console.log(gec result : ", nothing)
})
# Dxplaination of parameters:
field | type | describe |
---|---|---|
txt | string | Input Text, UTF-8 Encoding, with a maximum length of 30 The word |
# Text error correction results
{
"origin": ["I," "We," "Go," "learning," "Small," "up," "Learn"],
"masked_tokens": ["I," "We," "Go," "learning," "[MASK]", "up," "Learn"],
"corrections": [
{
"pos": 4,
"corrections": ["School"]
}
]
}
# Return value:
field | type | describe |
---|---|---|
pos | number | Position of the wrong word |
corrections | Array | Corrected words |