Examples of SRInstance


Examples of org.speakright.core.SRInstance

   */
  @Test public void testReorderNoConfirm()
  {
    TrailWrapper wrap1 = createApp(false);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, createNBestResults("austin|||boston")); //nbest results with 'austin' as top result
    Proceed(run, "");
    ChkFinished();
    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "boston", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  @Test public void testConfirmNoYes()
  {
    log("---- testConfirmNoYes ---");
    TrailWrapper wrap1 = createApp(true);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, createNBestResults("austin|||boston")); //nbest results with 'austin' as top result
    Proceed(run, "no")//reject austin
    Proceed(run, "yes"); //accept boston
    Proceed(run, "");
    ChkFinished();

    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "boston", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;NBestConfirmerFlow;NBestConfirmerFlow;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  @Test public void testConfirmYes()
  {
    log("---- testConfirmYes ---");
    TrailWrapper wrap1 = createApp(true);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, createNBestResults("austin|||boston")); //nbest results with 'austin' as top result
    Proceed(run, "yes"); //accept austin
    Proceed(run, "");
    ChkFinished();

    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "austin", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;NBestConfirmerFlow;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  @Test public void testConfirmNoNo()
  {
    log("---- testConfirmNoNo ---");
    TrailWrapper wrap1 = createApp(true);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, createNBestResults("austin|||boston")); //nbest results with 'austin' as top result
    Proceed(run, "no")//reject austin
    Proceed(run, "no"); //reject austin
    //so it asks the question again
    Proceed(run, createNBestResults("chaustin|||boston")); //nbest results with 'chaustin' as top result
    Proceed(run, "yes")//reject austin
    Proceed(run, "");
    ChkFinished();

    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "chaustin", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;NBestConfirmerFlow;NBestConfirmerFlow;CityQuestion;NBestConfirmerFlow;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  @Test public void testConfirmNoNBest()
  {
    log("---- testConfirmNoNBest ---");
    TrailWrapper wrap1 = createApp(true);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, "boston", "slot1", 100); //just because we enable nbest doesn't mean we'll get it!
    Proceed(run, "");
    ChkFinished();

    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "boston", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  @Test public void testSkipList()
  {
    log("---- testSkipList ---");
    TrailWrapper wrap1 = createApp(true, true);
   
    SRInstance run = StartIt(wrap1);
    Proceed(run, "");
    Proceed(run, createNBestResults("austin|||boston")); //nbest results with 'austin' as top result
    Proceed(run, "no")//reject austin
    Proceed(run, "no"); //reject austin
    //so it asks the question again
    Proceed(run, createNBestResults("boston|||chaustin")); //nbest results with 'chaustin' as top result
    //we already rejected boston, so it should be removed by the skiplist
    Proceed(run, "");
    ChkFinished();

    //check that the QuestionFlow changed austin to boston
    Model M = (Model)run.getModel();
    assertEquals("M.city", "chaustin", M.city().get());
   
    ChkTrail(run, "PromptFlow;CityQuestion;NBestConfirmerFlow;NBestConfirmerFlow;CityQuestion;PromptFlow");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

  {
    App1 flow = new App1();
    TrailWrapper wrap1 = new TrailWrapper(flow);
   
   
    SRInstance run = StartIt(wrap1);
    String path = String.format("tmpfiles\\sr_1.out");
    SRPersistentState state = new SRPersistentState(run, path);
   
    try
    {
      FileOutputStream fout = new FileOutputStream(path);
      boolean b = state.passivate(fout, path);
      assertEquals("b",true,b);
      fout.close();
    }
    catch(Exception e)
    {}

    try
    {
      path = state.m_streamId;
      FileInputStream fin = new FileInputStream(path);
      boolean b = state.activate(fin);
      assertEquals("b",true,b);
      fin.close();
      state.m_run.finishActivation();
      state.m_run.restoreModelBinder(new ModelBinder());
    }
    catch(Exception e)
    {}
   
    run = state.m_run; //the recreated run object
    wrap1 = (TrailWrapper)run.ApplicationFlow();
    assertEquals("appflow", "org.speakright.core.TrailWrapper", wrap1.getClass().getCanonicalName());
   
    Proceed(run, "id33");
    Proceed(run, "222");
    Proceed(run);
View Full Code Here

Examples of org.speakright.core.SRInstance

    {}
    return state;   
  }
  SRPersistentState persistentStartIt(IFlow flow, String path)
  {
    SRInstance run = StartIt(flow);
    return passivate(run, path);
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

    persistentProceed(path, "choice1");
    persistentProceed(path, "");
    persistentProceed(path, "choice2");
    persistentProceed(path, "");
    persistentProceed(path, "choice1");
    SRInstance run = persistentProceed(path, SRResults.ResultCode.DISCONNECT);
    wrap1 = (TrailWrapper)run.ApplicationFlow();
    assertEquals("fail", false, run.isFailed());
    assertEquals("fin", true, run.isFinished());
    assertEquals("start", true, run.isStarted());
   
    ChkTrail(run, "id;pwd;b;ask;choice1;ask;choice2;ask;choice1");
    ChkTrail(wrap1, "beg;F;N;N;DISC;end");
    log("---------end serial2-------");
  }
View Full Code Here

Examples of org.speakright.core.SRInstance

   
   
    String path = String.format("tmpfiles\\sr_3.out");
    persistentStartIt(wrap1, path);
   
    SRInstance run;
   
    persistentProceed(path, "");
//    persistentProceed(path, "");
    persistentProceed(path, "joe");
//    persistentProceed(path, "sue");
    run = persistentProceed(path, SRResults.ResultCode.DISCONNECT);
    wrap1 = (TrailWrapper)run.ApplicationFlow();
    assertEquals("fail", false, run.isFailed());
    assertEquals("fin", true, run.isFinished());
    assertEquals("start", true, run.isStarted());
   
    ChkTrail(run, "PFlow;PFlow;QFlow");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.