Show / Hide Table of Contents

Class NSAIAgent

AI services, such as Translation, Statistics, Sentiment analysis, backed by calls to Public Cloud providers.

Syntax
Examples
NSAIAgent agent;
agent.callMethod(arg1, arg2);

Constructors

NSAIAgent()

Initializes a new instance of the NSAIAgent class.

Declaration
NSAIAgent
Examples
NSAIAgent agent;
agent.callMethod(arg1, arg2);

Methods

DetectLanguage(String)

Given a (reasonably short) text, detect the language it is written in.

Declaration
String DetectLanguage(String text)
Parameters
Type Name Description
String text
Returns
Type Description
String
Examples
NSAIAgent agent;
String text;
String res = agent.DetectLanguage(text);

DetectSentiment(String)

Detect the sentiment of a (reasonably short) text. Sentiment analysis may cause a translation to be made, since sentiment analysis only supports a limited set of languages

Declaration
NSSentiment DetectSentiment(String text)
Parameters
Type Name Description
String text
Returns
Type Description
NSSentiment
Examples
NSAIAgent agent;
String text;
Sentiment res = agent.DetectSentiment(text);

GetTrainingStatus()

Calling the HugoAI endpoint to fetch the current training status.

Declaration
NSCategorizationStatusResponse GetTrainingStatus()
Returns
Type Description
NSCategorizationStatusResponse

Carrier to describe the current status of HugoAI categorization.

Examples
NSAIAgent agent;
NSCategorizationStatusResponse res = agent.GetTrainingStatus();

GuessCategory(Integer)

Given a ticket's ID, guess the ticket category it should be placed in.

Declaration
Integer GuessCategory(Integer ticketId)
Parameters
Type Name Description
Integer ticketId

ticket Id.

Returns
Type Description
Integer

ticket category.

Remarks

Currently this is based on the first message in the ticket.

Examples
NSAIAgent agent;
Integer ticketId;
Integer res = agent.GuessCategory(ticketId);

TrainCategoryGuesser(Integer,Integer,Integer)

The category guesser training API will be called with an array of CategorizationTrainingItem during the (background, Batch) execution of this call.

Declaration
String TrainCategoryGuesser(Integer selectionId, Integer maxItems, Integer maxTextLength)
Parameters
Type Name Description
Integer selectionId
Integer maxItems
Integer maxTextLength
Returns
Type Description
String
Examples
NSAIAgent agent;
Integer selectionId;
Integer maxItems;
Integer maxTextLength;
String res = agent.TrainCategoryGuesser(selectionId, maxItems, maxTextLength);

Translate(String,String)

Translate a text from one language to another.

Declaration
String Translate(String text, String targetLanguage)
Parameters
Type Name Description
String text

Original text

String targetLanguage

The language to translate to.

Returns
Type Description
String

translated text.

Remarks

Language of the text is automatically detected.

Examples
NSAIAgent agent;
String text;
String targetLanguage;
String res = agent.Translate(text, targetLanguage);
In This Article
  • Constructors
    • NSAIAgent()
  • Methods
    • DetectLanguage(String)
    • DetectSentiment(String)
    • GetTrainingStatus()
    • GuessCategory(Integer)
    • TrainCategoryGuesser(Integer,Integer,Integer)
    • Translate(String,String)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top