Skip to main content

Text-Categorization

Command Description

To classify specified text, a classifcation model needs to be trained in Laiye IDP in advance

Command Prototype

arrayRet = Mage.NLPTextClassify(doc,config,time)

Parameter Description

ParameterRequiredTypeDefaultDescription
docTruestring""Enter the text information for classification
configTrueexpression{}Call configuration of Laiye IDP
timeTruenumber30000Specify the waiting time in milliseconds. If exceeded, an exception will be thrown. Default: 30,000 milliseconds (30 seconds)

return

arrayRet,The variable used to save the output of the command.

Demo

Dim doc="Macron announces French police reform measures: increase the number of police officers  strengthen law enforcement supervision  China News Agency, Paris, September 14th   (Reporter  Li Yang) French President Macron announced the French police reform on the 14th local time related measures, including increasing the number of police, strengthening law enforcement supervision, improving police treatment, simplifying investigation procedures, etc. Macron visited Roubaix in northern France on the same day, and he announced the French police at the closing ceremony of the security roundtable held locally. "Complete strategy" of reform to improve law and order in France and protect the interests of the people."  // Test data 
Dim config={"Pubkey":"","Secret":"","Url":""} // Get from mage

TracePrint "--------------------Text Classification--------------------"
// --------------------------------------------------------
// [Remarks] To classify the incoming text, you need to obtain the Key and Secret corresponding to the "text classification model"
// Input parameter 1:
// doc--text to be classified.Type:String
// Input parameter 2:
// config--mage configuration, need to configure Pubkey and Secret.Type:Dict
// Input parameter 3:
// time--timeout time. Default unit: milliseconds. Type: Int

// Output parameters:
// arrayRet--The variable to which the output of the function call is saved

// Command prototype: arrayRet = Mage.NLPTextClassify(doc,config,time)
// --------------------------------------------------------

arrayRet = Mage.NLPTextClassify(doc,config,3000)
TracePrint(arrayRet)