public override void OnInspectorGUI() { if (myObject == null) myObject = target as FilterInteractions; if (myObject != null) { if ( GUILayout.Button("Perform NLU Test") ) myObject.TestCommandVariations(); } base.DrawDefaultInspector(); }
public void Awake() { instance = this; }
public void AddVariation( FilterInteractions.CommandVariation variation ) { #if LOADXML return; #endif if ( variation == null ) return; if ( variation.Cmd == "" || variation.Cmd == null || variation.Variations == null || variation.Variations.Count == 0 ) return; if ( variations == null ) variations = new List<CommandVariation>(); // add a stripped down version of the CmdString to the variations // this may need some tuning, but seems to work faily well and saves a lot of editing command variations string strippedCommand = variation.CmdString.ToLower(); strippedCommand = strippedCommand.Replace (" the ", " "); strippedCommand = strippedCommand.Replace (" and ", " "); strippedCommand = strippedCommand.Replace (" patient ", " "); strippedCommand = strippedCommand.Replace (" patient's ", " "); strippedCommand = strippedCommand.Replace ("perform ", ""); strippedCommand = strippedCommand.Replace (" a ", " "); strippedCommand = strippedCommand.Replace (" an ", " "); strippedCommand = strippedCommand.Replace (".", " "); strippedCommand = strippedCommand.Replace (",", " "); strippedCommand = strippedCommand.Replace (" them ", " "); strippedCommand = strippedCommand.Replace (" we ", " "); variation.Variations.Add (strippedCommand); bool found=false; foreach( CommandVariation cv in variations ) { // see if command is already in list if ( cv.Cmd == variation.Cmd ) { found = true; // add any variations that aren't duplicates cv.AddVariations(variation.Variations); } } // nothing found, just add it if ( found == false ) variations.Add(variation); }