Add preprocessing for replacing polish characters
This commit is contained in:
parent
3f02c41b1f
commit
d38fbee2ec
@ -2,8 +2,8 @@ import re
|
|||||||
|
|
||||||
from acts import hello_act, name_request_act
|
from acts import hello_act, name_request_act
|
||||||
|
|
||||||
hello = ['dzie[ńn] dobry', 'dobry wiecz[oó]r', 'witam', 'witaj', 'siema', 'elo', 'cze[śs][ćc]']
|
hello = ['dzien dobry', 'dobry wieczor', 'witam', 'witaj', 'siema', 'elo', 'czesc']
|
||||||
request_name = ['imi[eę]', 'nazywasz']
|
request_name = ['imie', 'nazywasz']
|
||||||
question = ['\?$']
|
question = ['\?$']
|
||||||
|
|
||||||
acts = {hello_act: [hello],
|
acts = {hello_act: [hello],
|
||||||
@ -16,6 +16,18 @@ def analizator_jezyka_naturalnego(text):
|
|||||||
|
|
||||||
def text_preprocess(text):
|
def text_preprocess(text):
|
||||||
text = text.lower()
|
text = text.lower()
|
||||||
|
text = text.replace("ą", "a")
|
||||||
|
text = text.replace("ć", "c")
|
||||||
|
text = text.replace("ę", "e")
|
||||||
|
text = text.replace("ł", "l")
|
||||||
|
text = text.replace("ń", "n")
|
||||||
|
text = text.replace("ó", "o")
|
||||||
|
text = text.replace("ś", "s")
|
||||||
|
text = text.replace("ź", "z")
|
||||||
|
text = text.replace("ż", "z")
|
||||||
|
text = text.replace("\n", " ")
|
||||||
|
text = text.replace("\t", " ")
|
||||||
|
text = text.replace(" ", " ")
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def act_check(text):
|
def act_check(text):
|
||||||
|
Loading…
Reference in New Issue
Block a user