Building Chatbots in Python
Alan Nichol
Co-founder and CTO, Rasa

restaurant_search lze vyjádřit mnoha způsoby:
request_booking
'|' odpovídá operátoru ORre.search(r"(hello|hey|hi)", "hey there!") is not None
True
re.search(r"(hello|hey|hi)", "which one?") is not None
True
\b označuje začátek nebo konec slovare.search(r"\b(hello|hey|hi)\b", "hey there!") is not None
True
re.search(r"\b(hello|hey|hi)\b", "which one?") is not None
False
pattern = re.compile('[A-Z]{1}[a-z]*')message = """ Mary is a friend of mine, she studied at Oxford and now works at Google"""pattern.findall(message)
['Mary', 'Oxford', 'Google']
Building Chatbots in Python