Beispiel #1
0
        public static WatsonCompleteSpeechToTextSync CreateInstance(LexiconWorkspace workspace)
        {
            WatsonCompleteSpeechToTextSync instance = CreateInstance <WatsonCompleteSpeechToTextSync>();

            instance.workspace = workspace;
            return(instance);
        }
        public void SyncWatsonSpeechToText(LexiconWorkspace workspace, WorkspaceSyncData syncData)
        {
            workspace.WatsonSpeechToTextManager.IsSyncing  = true;
            workspace.WatsonSpeechToTextManager.SyncStatus = "Syncing";

            WatsonSyncQueue syncQueue = ScriptableObject.CreateInstance <WatsonSyncQueue>();

            syncQueue.workspace = workspace;
            syncQueue.syncData  = syncData;

            if (string.IsNullOrEmpty(workspace.WatsonSpeechToTextManager.CustomizationId))
            {
                syncQueue.Enqueue(WatsonCustomModelCreate.CreateInstance(workspace));
            }
            else
            {
                syncQueue.Enqueue(WatsonCustomWordsUpdate.CreateInstance(workspace));
                syncQueue.Enqueue(TimerSyncAction.CreateInstance(10));
            }

            syncQueue.Enqueue(WatsonCorpusAddIntents.CreateInstance(workspace));
            syncQueue.Enqueue(TimerSyncAction.CreateInstance(10));
            syncQueue.Enqueue(WatsonCorpusAddEntities.CreateInstance(workspace));
            syncQueue.Enqueue(TimerSyncAction.CreateInstance(10));
            syncQueue.Enqueue(WatsonCustomModelTrain.CreateInstance(workspace));
            syncQueue.Enqueue(TimerSyncAction.CreateInstance(10));

            syncQueue.OnCompleteAction = WatsonCompleteSpeechToTextSync.CreateInstance(workspace);
            syncQueue.OnQueueFinished += CleanUp;

            syncQueue.Process();

            watsonSpeechToTextSyncQueues.Add(syncQueue);
        }