systemy_dialogowe/SDMockup.ipynb
wojciechbatruszewicz c6a4cb754e Mockups nlu
2023-03-31 19:23:16 +02:00

1.9 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')]}