Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Commit

Permalink
中文标点
Browse files Browse the repository at this point in the history
  • Loading branch information
bigeagle committed Feb 5, 2012
1 parent 3aaa6c5 commit 256358a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aiml/PatternMgr.py
Expand Up @@ -24,7 +24,7 @@ def __init__(self):
self._botName = u"Nameless"
punctuation = re.escape(u"\"`~!@#$%^&*()-_=+[{]}\|;:',<.>/?")
self._puncStripRE = re.compile("u[" + punctuation + u"]")
self._upuncStripRE = re.compile(u" [!,。?;:]")
self._upuncStripRE = re.compile(u"[!,。?;:~……“、[]·”‘’()——]")
self._whitespaceRE = re.compile("\s", re.LOCALE | re.UNICODE)
self._lang_support = LangSupport.UnicodeSupport()

Expand Down Expand Up @@ -146,7 +146,7 @@ def match(self, pattern, that, topic):
input = string.upper(pattern)
input = self._puncStripRE.sub("", input)
input = self._upuncStripRE.sub(u"", input)

print input
if that.strip() == u"": that = u"ULTRABOGUSDUMMYTHAT" # 'that' must never be empty
thatInput = string.upper(that)
thatInput = re.sub(self._whitespaceRE, " ", thatInput)
Expand Down

0 comments on commit 256358a

Please sign in to comment.