Update NaturalLanguageGeneration.py

This commit is contained in:
PawelDopierala 2024-04-23 00:26:55 +02:00
parent 5d77dc0914
commit a2a83332e4
1 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,12 @@
import re
class NaturalLanguageGeneration:
def nlg(self, system_act):
response = None
name = "James"
if system_act == f"inform(name={name})":
pattern = r'inform\(name=([^\)]+)\)'
matching = re.search(pattern, system_act)
if matching:
name = matching.group(1)
response = f"Witaj, nazywam się {name}"
return response