def test_inform_superheroes_loyalty(nlu): """ Tests exemplary whether a given user utterance, is recognized as belonging to a certain slot-value pair Args: nlu: NLU Object (given in conftest.py) """ act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "loyalty" act_out.value = "Avengers" usr_utt = nlu.extract_user_acts(nlu, user_utterance='they should be part of Avengers') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_courses_language(): """ Tests exemplary whether a given synonym, i.e. a user utterance, is recognized as belonging to a certain slot-value pair """ domain = JSONLookupDomain('ImsCourses') nlu = HandcraftedNLU(domain) act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "lang" act_out.value = "de" usr_utt = nlu.extract_user_acts(nlu, user_utterance='german') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_superheroes_primary_uniform_color(nlu): """ Tests exemplary whether a given user utterance, is recognized as belonging to a certain slot-value pair Args: nlu: NLU Object (given in conftest.py) """ act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "primary_uniform_color" act_out.value = "Purple" usr_utt = nlu.extract_user_acts(nlu, user_utterance='the uniform should be Purple') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_lecturers_name(): """ Tests exemplary whether a given synonym, i.e. a user utterance, is recognized as belonging to a certain slot-value pair """ domain = JSONLookupDomain('ImsLecturers') nlu = HandcraftedNLU(domain) act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "name" act_out.value = "apl. prof. dr. agatha christie" usr_utt = nlu.extract_user_acts(nlu, user_utterance='agatha christie') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_lecturers_department(): """ Tests exemplary whether a given synonym, i.e. a user utterance, is recognized as belonging to a certain slot-value pair """ domain = JSONLookupDomain('ImsLecturers') nlu = HandcraftedNLU(domain) act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "department" act_out.value = "external" usr_utt = nlu.extract_user_acts(nlu, user_utterance='informatics') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_binary_mensa_vegan(): """ Tests exemplary whether a given synonym, i.e. a user utterance, is recognized as belonging to a certain binary slot-value pair """ domain = MensaDomain() nlu = MensaNLU(domain) act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "vegan" act_out.value = "true" usr_utt = nlu.extract_user_acts(nlu, user_utterance='vegan, please') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_inform_mensa_type(): """ Tests exemplary whether a given synonym, i.e. a user utterance, is recognized as belonging to a certain slot-value pair """ domain = MensaDomain() nlu = MensaNLU(domain) act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "type" act_out.value = "starter" usr_utt = nlu.extract_user_acts(nlu, user_utterance='I want a starter') assert 'user_acts' in usr_utt assert usr_utt['user_acts'][0] == act_out
def test_multiple_user_acts_mensa(): """ Tests exemplary whether a given sentence with multiple user acts is understood properly """ domain = MensaDomain() nlu = MensaNLU(domain) usr_utt = nlu.extract_user_acts( nlu, user_utterance='Hi, I want a dish with fish') assert 'user_acts' in usr_utt act_out = UserAct() act_out.type = UserActionType.Hello assert usr_utt['user_acts'][0] == act_out act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "fish" act_out.value = "true" assert usr_utt['user_acts'][1] == act_out
def test_multiple_user_acts_courses(): """ Tests exemplary whether a given sentence with multiple user acts is understood properly """ domain = JSONLookupDomain('ImsCourses') nlu = HandcraftedNLU(domain) usr_utt = nlu.extract_user_acts( nlu, user_utterance='Hi, I want a course that is related to linguistics') assert 'user_acts' in usr_utt act_out = UserAct() act_out.type = UserActionType.Hello assert usr_utt['user_acts'][0] == act_out act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "linguistics" act_out.value = "true" assert usr_utt['user_acts'][1] == act_out
def test_multiple_user_acts_lecturers(): """ Tests exemplary whether a given sentence with multiple user acts is understood properly """ domain = JSONLookupDomain('ImsLecturers') nlu = HandcraftedNLU(domain) usr_utt = nlu.extract_user_acts( nlu, user_utterance= 'Hi, I want a lecturer who is responsible for gender issues') assert 'user_acts' in usr_utt act_out = UserAct() act_out.type = UserActionType.Hello assert usr_utt['user_acts'][0] == act_out act_out = UserAct() act_out.type = UserActionType.Inform act_out.slot = "position" act_out.value = "gender" assert usr_utt['user_acts'][1] == act_out