summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsand <daniel@spatof.org>2013-05-14 13:17:11 (GMT)
committer sand <daniel@spatof.org>2013-05-14 13:17:11 (GMT)
commitb611d5548acf044355bc9721f34bfda7972cd848 (patch)
treeee2a2af9682c1b992e24084c61000b143fd02b49
parent8b7f91ef7d57de8b677c49ba570eb0782456374b (diff)
fix per megahal
-rw-r--r--pinolo/plugins/megahal.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pinolo/plugins/megahal.py b/pinolo/plugins/megahal.py
index a88cf1f..651b153 100644
--- a/pinolo/plugins/megahal.py
+++ b/pinolo/plugins/megahal.py
@@ -49,6 +49,7 @@ __license__ = 'BSD'
log = logging.getLogger(__name__)
r_irclog = re.compile(r"^\[[^]]+\]\s+")
+r_ircsubject = re.compile(r"<[^>]+>")
DEFAULT_ORDER = 5
DEFAULT_BRAINFILE = os.path.join(os.environ.get('HOME', ''), '.pymegahal-brain')
@@ -462,13 +463,13 @@ class MegaHAL(object):
self.learn(line)
def train_from_irclog(self, filename):
- # [28-Apr-2013 09:09:20] <nightolo> mancausoft: se vogliono fare la riforma costituzionale possono farla subito
with codecs.open(filename, "rb", encoding="utf-8") as fd:
for line in fd:
line = line.strip()
- line = r_irclog.sub(line, "")
+ line = r_irclog.sub("", line)
if not line.startswith("<"):
continue
+ line = r_ircsubject.sub("", line)
self.learn(line)
def learn(self, phrase):