rewrite classifier

This commit is contained in:
Andreas Stephanides
2017-08-07 10:20:28 +02:00
parent ff0bdc6d3b
commit 94d8d26187
11 changed files with 411 additions and 98 deletions

View File

@@ -32,6 +32,7 @@ class MailThread(Base):
__jsonattrs__=None
answered=False
maintopic="information"
lang=""
def bdy(self):
return yaml.load(self.body)
@@ -50,7 +51,7 @@ class MailThread(Base):
def tstr(self):
fr=yaml.load(self.mails()[0].from_)
return "(" + str(self.answered)+ ", "+ str(self.maintopic) + ") " + str(self.firstmail)+": "+str(fr[0]["mail"])+"@"+str(fr[0]["host"]) + " | ".join(yaml.load(self.mails()[0].subject))
return "(" + str(self.answered)+ ", "+ str(self.maintopic)+ ", "+ str(self.lang) + ") " + str(self.firstmail)+": "+str(fr[0]["mail"])+"@"+str(fr[0]["host"]) + " | ".join(yaml.load(self.mails()[0].subject))
def mails(self):
a=[]
@@ -111,7 +112,7 @@ class MailThread(Base):
elif filter=="first":
a=mail_txt(m[0])
a=re.sub(r'\n\s*\n',r'\n',a)
a=re.sub(r'<!--.*-->',r'',a,flags=re.MULTILINE|re.DOTALL)
# a=re.sub(r'<!--.*-->',r'',a,flags=re.MULTILINE|re.DOTALL)
a=re.sub(r'\s*>+ .*\n',r'',a)