Get-Ranking-Results
Command Description
Get ranking results of text category
Command Prototype
arrayTopNRet = Mage.ExtractTextClassifyTopN(arrayRet, thrd, top_n)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
arrayRet | True | expression | arrayRet | Use variable output to the text classification command |
thrd | True | number | 0.6 | Set threshold for the confidence range of classification results from 0-1. And filter results >= the threshold |
top_n | True | number | 1 | Support inputting a positive integer starting from 1. For example, input 5 and the confidence threshold is 0.6, then the top 5 results with confidence level greater than or equal to 0.6 will be returned |
return
arrayTopNRet,The variable used to save the output of the command.
Demo
Dim arrayRet = [{"ai_function" : "nlp_text_classify","class_id" : 1473,"class_label" : "国际","debug_info" : [],"score" : 0.6527229},{"ai_function" : "nlp_text_classify","class_id" : 1469,"class_label" : "时政","debug_info" : [],"score" : 0.230379},{"ai_function" : "nlp_text_classify","class_id" : 1472,"class_label" : "科技","debug_info" : [],"score" : 0.05750105},{"ai_function" : "nlp_text_classify","class_id" : 1471,"class_label" : "体育","debug_info" : [],"score" : 0.037129827},{"ai_function" : "nlp_text_classify","class_id" : 1470,"class_label" : "财经","debug_info" : [],"score" : 0.022317171}] // Test数据
Dim thrd=0.6 // Confidence
Dim top_n=1 // Get the top
TracePrint "--------------------Get ranking results--------------------"
// --------------------------------------------------------
// [Remarks] Rank the incoming text classification recognition results
// Input parameter 1:
// arrayRet--text classification result.Type:List(recognition result of text classification)
// Input parameter 2:
// thrd--Confidence.Type: decimal between 0 and 1
// Input parameter 3:
// top_n--Get the top few.Type:Int
// Output parameters:
// arrayTopNRet--The variable to which the output of the function call is saved
// Command prototype: arrayTopNRet = Mage.ExtractTextClassifyTopN(arrayRet, thrd, top_n)
// --------------------------------------------------------
arrayTopNRet = Mage.ExtractTextClassifyTopN(arrayRet, thrd, top_n)
TracePrint arrayTopNRet