systemy_dialogowe/SDMockup.ipynb
2023-03-31 22:30:50 +02:00

2.0 KiB

ASR

def asr(inputText: str) -> str:
    # Do something
    inputText

NLU

class Nlu:
    def __init__(self, text: str):
        self.text = text
        self.slot = []
        
    def get_dialog_act(self):
        act = "question" if "?" in self.text  else ""
        if "imię" in self.text:
            self.slot.append(("o_co", "imie"))
        return {"act": act, "slot": self.slot }

nlu = Nlu("Jak masz na imię?")
nlu.get_dialog_act()
{'act': 'question', 'slot': [('o_co', 'imie')]}