protected void finish(HoundPartialTranscriptJSON result) { if (fieldGeneratorFormat.have_value) { result.setFormat(fieldGeneratorFormat.value); fieldGeneratorFormat.have_value = false; } else if ((!(result.hasFormat())) && !allow_incomplete) { error("When parsing the object for %what%, the \"Format\" field was missing."); } if (fieldGeneratorFormatVersion.have_value) { result.setFormatVersion(); fieldGeneratorFormatVersion.have_value = false; } else if ((!(result.hasFormatVersion())) && !allow_incomplete) { error("When parsing the object for %what%, the \"FormatVersion\" field was missing."); } if (fieldGeneratorPartialTranscript.have_value) { result.setPartialTranscript(fieldGeneratorPartialTranscript.value); fieldGeneratorPartialTranscript.have_value = false; } else if ((!(result.hasPartialTranscript())) && !allow_incomplete) { error("When parsing the object for %what%, the \"PartialTranscript\" field was missing."); } if (fieldGeneratorDurationMS.have_value) { result.setDurationMSText(fieldGeneratorDurationMS.value); fieldGeneratorDurationMS.have_value = false; } else if ((!(result.hasDurationMS())) && !allow_incomplete) { error("When parsing the object for %what%, the \"DurationMS\" field was missing."); } if (fieldGeneratorDone.have_value) { result.setDone(fieldGeneratorDone.value); fieldGeneratorDone.have_value = false; } else if ((!(result.hasDone())) && !allow_incomplete) { error("When parsing the object for %what%, the \"Done\" field was missing."); } if (fieldGeneratorSafeToStopAudio.have_value) { result.setSafeToStopAudio(fieldGeneratorSafeToStopAudio.value); fieldGeneratorSafeToStopAudio.have_value = false; } if (fieldGeneratorLocalOrRemote.have_value) { result.setLocalOrRemote(fieldGeneratorLocalOrRemote.value); fieldGeneratorLocalOrRemote.have_value = false; } }
// The handle method is called whenever a partial transcript is received by the client public override void handle(HoundPartialTranscriptJSON partial) { if (show_transcript) { Debug.Log(partial.getPartialTranscript()); if (partial.getSafeToStopAudio()) { bt.stopRecording = true; } } }
public override void handle(HoundPartialTranscriptJSON partial) { if (show_transcript) { Console.Error.Write("Partial Transcript"); if (partial.hasLocalOrRemote()) { Console.Error.Write(" [{0}]", ((partial.getLocalOrRemote() == HoundPartialTranscriptJSON.TypeLocalOrRemote. LocalOrRemote_Local) ? "Local" : "Remote")); } Console.Error.Write(": `{0}'.\n", partial.getPartialTranscript()); } }
protected override void finish() { HoundPartialTranscriptJSON result = new HoundPartialTranscriptJSON(); Debug.Assert(result != null); finish(result); int extra_count = unknownFieldGenerator.field_names.Count; Debug.Assert(extra_count == unknownFieldGenerator.field_values.Count); for (int extra_num = 0; extra_num < extra_count; ++extra_num) { result.extraHoundPartialTranscriptAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]); } unknownFieldGenerator.field_names.Clear(); unknownFieldGenerator.field_values.Clear(); unknownFieldGenerator.index = new Dictionary <string, JSONValue>(); handle_result(result); }
public abstract void handle(HoundPartialTranscriptJSON partial);
protected override void handle_result(HoundPartialTranscriptJSON result) { top.value.Add(result); }
protected override void handle_result(HoundPartialTranscriptJSON result) { //@@@ Debug.Assert(!have_value); have_value = true; value = result; }
protected abstract void handle_result(HoundPartialTranscriptJSON new_result);
private void fromJSONValue(JSONValue json_value, bool ignore_extras) { Debug.Assert(json_value != null); TypeValue or_result = new TypeValue(); bool or_done = false; if (!or_done) { try { HoundServerJSON convert_classy = HoundServerJSON.from_json(json_value, ignore_extras, true); or_result.u.choice0 = convert_classy; or_result.key = 0; or_done = true; } catch (Exception) { } } if (!or_done) { try { HoundPartialTranscriptJSON convert_classy = HoundPartialTranscriptJSON.from_json(json_value, ignore_extras, true); or_result.u.choice1 = convert_classy; or_result.key = 1; or_done = true; } catch (Exception) { } } if (!or_done) { try { HoundUpdateJSON convert_classy = HoundUpdateJSON.from_json(json_value, ignore_extras, true); or_result.u.choice2 = convert_classy; or_result.key = 2; or_done = true; } catch (Exception) { } } if (!or_done) { throw new Exception("The value for field Value of HoundMessageJSON is not one of the allowed values."); } setValue(or_result); switch (or_result.key) { case 0: break; case 1: break; case 2: break; default: Debug.Assert(false); break; } }