Assets/Watson/Scripts/Services/LanguageTranslation/LanguageTranslation.cs
/// <summary>
/// Identifies a language from the given text.
/// </summary>
/// <param name="text">The text sample to ID.</param>
/// <param name="callback">The callback to receive the results.</param>
/// <returns></returns>
Identifies a language from the given text.
Identifies a language from the given text .
public bool Identify(string text, IdentifyCallback callback)
        {
            if (string.IsNullOrEmpty(text))
                throw new ArgumentNullException("text");
            if (callback == null)
                throw new ArgumentNullException("callback");
            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, "/v2/identify");
            if (connector == null)
                return false;
            IdentifyReq req = new IdentifyReq();
            req.Callback = callback;
            req.Send = Encoding.UTF8.GetBytes(text);
            req.Headers["Content-Type"] = "text/plain";
            req.OnResponse = OnIdentifyResponse;
            return connector.Send(req);
        }
public bool Identify ( string text , IdentifyCallback callback ) { if ( string . IsNullOrEmpty ( text ) ) throw new ArgumentNullException ( " " ) ; if ( callback == null ) throw new ArgumentNullException ( " " ) ; RESTConnector connector = RESTConnector . GetConnector ( SERVICE_ID , " " ) ; if ( connector == null ) return false ; IdentifyReq req = new IdentifyReq ( ) ; req . Callback = callback ; req . Send = Encoding . UTF8 . GetBytes ( text ) ; req . Headers [ " " ] = " " ; req . OnResponse = OnIdentifyResponse ; return connector . Send ( req ) ; }
Identifies a language from the given text.
Identifies a language from the given text .
None
text
string
The text sample to ID.
The text sample to ID .
callback
IdentifyCallback
The callback to receive the results.
The callback to receive the results .