Assets/Watson/Scripts/Services/SpeechToText/SpeechToText.cs
/// <summary>
/// Overload method for AddCustomCorpus that takes byteArray training data.
/// </summary>
/// <param name="callback">The callback.</param>
/// <param name="customizationID">The customization ID with the corpus to be deleted.</param>
/// <param name="corpusName">The corpus name to be deleted.</param>
/// <param name="allowOverwrite">Allow overwriting of corpus data.</param>
/// <param name="trainingData">ByteArray data for training data.</param>
/// <param name="customData">Optional customization data.</param>
Overload method for AddCustomCorpus that takes byteArray training data.
Overload method for AddCustomCorpus that takes byteArray training data .
public bool AddCustomCorpus(OnAddCustomCorpusCallback callback, string customizationID, string corpusName, bool allowOverwrite, byte[] trainingData, string customData = default(string))
		{
			if (callback == null)
				throw new ArgumentNullException("callback");
			if (string.IsNullOrEmpty(customizationID))
				throw new ArgumentNullException("A customizationID is required for AddCustomCorpus.");
			if (string.IsNullOrEmpty(corpusName))
				throw new ArgumentNullException("A corpusName is requried for AddCustomCorpus.");
			if (trainingData == default(byte[]))
				throw new ArgumentNullException("Training data is required for AddCustomCorpus.");
			AddCustomCorpusRequest req = new AddCustomCorpusRequest();
			req.Callback = callback;
			req.CustomizationID = customizationID;
			req.CorpusName = corpusName;
			req.Data = customData;
			req.Headers["Content-Type"] = "application/x-www-form-urlencoded";
			req.Headers["Accept"] = "application/json";
			req.Parameters["allow_overwrite"] = allowOverwrite.ToString();
			req.Forms = new Dictionary<string, RESTConnector.Form>();
			req.Forms["body"] = new RESTConnector.Form(trainingData, "trainingData.txt", "text/plain");
			req.OnResponse = OnAddCustomCorpusResp;
			string service = "/v1/customizations/{0}/corpora/{1}";
			RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, string.Format(service, customizationID, corpusName));
			if (connector == null)
				return false;
			return connector.Send(req);
		}
public bool AddCustomCorpus ( OnAddCustomCorpusCallback callback , string customizationID , string corpusName , bool allowOverwrite , byte [ ] trainingData , string customData = default ( string ) ) { if ( callback == null ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( customizationID ) ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( corpusName ) ) throw new ArgumentNullException ( " " ) ; if ( trainingData == default ( byte [ ] ) ) throw new ArgumentNullException ( " " ) ; AddCustomCorpusRequest req = new AddCustomCorpusRequest ( ) ; req . Callback = callback ; req . CustomizationID = customizationID ; req . CorpusName = corpusName ; req . Data = customData ; req . Headers [ " " ] = " " ; req . Headers [ " " ] = " " ; req . Parameters [ " " ] = allowOverwrite . ToString ( ) ; req . Forms = new Dictionary < string , RESTConnector . Form > ( ) ; req . Forms [ " " ] = new RESTConnector . Form ( trainingData , " " , " " ) ; req . OnResponse = OnAddCustomCorpusResp ; string service = " " ; RESTConnector connector = RESTConnector . GetConnector ( SERVICE_ID , string . Format ( service , customizationID , corpusName ) ) ; if ( connector == null ) return false ; return connector . Send ( req ) ; }
Overload method for AddCustomCorpus that takes byteArray training data.
Overload method for AddCustomCorpus that takes byteArray training data .
callback
OnAddCustomCorpusCallback
None
customizationID
string
The customization ID with the corpus to be deleted.
The customization ID with the corpus to be deleted .
corpusName
string
The corpus name to be deleted.
The corpus name to be deleted .
allowOverwrite
bool
Allow overwriting of corpus data.
Allow overwriting of corpus data .
trainingData
byte[]
ByteArray data for training data.
ByteArray data for training data .
customData
string
Optional customization data.
Optional customization data .