Snippets

Furhat Robotics Adding vocabulary for open recognizer in skill file

Created by Ludvig Linse
public class YourSkill extends Skill {

	// ...
    
    // A list of words that should get preference in the recognizer.
	private List<String> phrases = Arrays.asList("Furhat", "London", "Amsterdam", "Paris", "Helsinki", "Stockholm", "Oslo"); 

    // ...
    
	@Override
	public void init() throws Exception {
		
		SkillHandler handler = getSkillHandler();
        
        // Pass in the phrases array to the OpenVocabularyContext
		handler.loadContext("context_with_phrases", new OpenVocabularyContext(language, phrases));
		handler.loadContext("context_with_phrases", new SemanticGrammarContext(new SRGSGrammar(getPackageFile("YourGrammar.xml"))));
		handler.setDefaultContext("context_with_phrases");
		
		// ...
	}
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.