Debugging¶
Web Interface¶
stepDP has a feature-rich web interface. This is accessible by default at http://127.0.0.1:50000. Here you can view the current tokens on the Blackboard and the existing rules. You can also add tokens to the Blackboard. In addition, the state chart can be displayed graphically and the current status is highlighted.
Print to Console¶
The easiest way to generate debug output is to simply print to the console. However, stepDP is a powerful logging framework (slf4j) already added as a dependency. Here, different levels of debug output can be generated, from an trace to error. The standard level is debug.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyClass
{
private static Logger log = LoggerFactory.getLogger(MyClass.class);
public void FunctionToDebug()
{
log.trace("Function 1 called, output as trace");
log.debug("Function 1 called, output as debug");
log.info("Function 1 called, output as info");
log.warn("Function 1 called, output as warn");
log.error("Function 1 called, output as error");
}
}
Voice Output¶
Simple speech output is available via the Web Speech API. Google Chrome is the recommended browser for this, as other browsers do not (yet) support this API. The Microsoft Edge browser works also, Firefox currently do not support the Web Speech API.
To use this voice output, open the web interface and click on Output. Activate the TTS output there and select a suitable voice.
In the code, you can easily call the speech output with the following static function:
public void SayHello()
{
de.dfki.step.web.Controller.createSpeechUtterance("Hello from the Speech Output");
}
Note: The speech output only works as long as the Chrome window is in focus or at least visible on the front of the desktop. If the Chrome window becomes inactive, the speech output stops.
Add custom Example Tokens¶
You can easily add your own sample tokens in the WebUI, which can be selected via the dropdown. Simply add the following code to the structure of your dialogue.
Controller.addExampleToken("add custom intent", "{\"type\": \"CustomIntent\", \"userName\":\"Alice\"}");