示例#1
0
 /**
  * Generates new simulated observations and adds them to the dialogue state. The method returns
  * true when a new user input has been generated, and false otherwise.
  *
  * @return whether a user input has been generated @
  */
 private boolean addNewObservations() {
   List<String> newObsVars = new ArrayList<String>();
   for (String var : simulatorState.getChanceNodeIds()) {
     if (var.contains("^o'")) {
       newObsVars.add(var);
     }
   }
   if (!newObsVars.isEmpty()) {
     MultivariateDistribution newObs = simulatorState.queryProb(newObsVars);
     for (String newObsVar : newObsVars) {
       newObs.modifyVariableId(newObsVar, newObsVar.replace("^o'", ""));
     }
     while (system.isPaused()) {
       try {
         Thread.sleep(50);
       } catch (InterruptedException e) {
       }
     }
     if (!newObs.getValues().isEmpty()) {
       if (newObs.getVariables().contains(system.getSettings().userInput)) {
         log.fine("Simulator output: " + newObs + "\n --------------");
         system.addContent(newObs);
         return true;
       } else {
         log.fine("Contextual variables: " + newObs);
         system.addContent(newObs);
       }
     }
   }
   return false;
 }
示例#2
0
 /** Adds an empty action to the dialogue system to start the interaction. */
 @Override
 public void start() {
   Assignment emptyAction = new Assignment(system.getSettings().systemOutput, ValueFactory.none());
   if (system.isPaused()) {
     system.getState().addToState(emptyAction);
   } else {
     system.addContent(emptyAction);
   }
   system.attachModule(RewardLearner.class);
 }