# Language model
This interface, from the plug-in 1.1.3 Start Support
Word-based language model. The input is a sentence and the output is the probability of each word in the sentence. Examples: Input: Weather in Shanghai Output: 6.66271953 e-05, 0.00470699137, 0.0291203912, 0.0323233753, 0.599718213
# 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 interface
const txt = "Weather in Shanghai"
plugin.api.lm(txt).then((nothing) => {
console.log("lm result : ", nothing)
})
# Request parameters:
field | type | describe |
---|---|---|
txt | string | 初始值 Encoding, with a maximum length of 1024 The word |
# Return to Results
{
"predictions": [
{
"tokens": ["<s>", "up," The sea, "of," "God," "Gas"],
"probs": [
0.0000666271953,
0.00470699137,
0.0291203912,
0.0323233753,
0.599718213
]
}
]
}
# Return value:
field | type | describe |
---|---|---|
probs | Array | Probability of each word |