|
@@ -31,13 +31,11 @@ class News():
|
|
|
try:
|
|
try:
|
|
|
a.download()
|
|
a.download()
|
|
|
a.parse()
|
|
a.parse()
|
|
|
- return
|
|
|
|
|
except Exception:
|
|
except Exception:
|
|
|
print("ERROR parsing/downloading article")
|
|
print("ERROR parsing/downloading article")
|
|
|
ERROR=True
|
|
ERROR=True
|
|
|
return
|
|
return
|
|
|
a.nlp()
|
|
a.nlp()
|
|
|
-
|
|
|
|
|
a.authors=self.dedup([self.fix_author(value) for value in a.authors if not self.isComment(value) and not self.isNoise(value)])
|
|
a.authors=self.dedup([self.fix_author(value) for value in a.authors if not self.isComment(value) and not self.isNoise(value)])
|
|
|
|
|
|
|
|
self.SCRAP_DATE=datetime.datetime.now()
|
|
self.SCRAP_DATE=datetime.datetime.now()
|
|
@@ -46,8 +44,11 @@ class News():
|
|
|
self.SUMMARY=a.summary
|
|
self.SUMMARY=a.summary
|
|
|
self.TEXT=a.text
|
|
self.TEXT=a.text
|
|
|
self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
self.HTML=htmlmin.minify(a.article_html,remove_empty_space=True)
|
|
|
|
|
+ lowertext=self.TEXT.lower()
|
|
|
for k in kw:
|
|
for k in kw:
|
|
|
- if re.match(k["pattern"], self.TEXT):
|
|
|
|
|
|
|
+ #if re.match(k["pattern"], self.TEXT): #FIXME regex vs string in string
|
|
|
|
|
+ matches=len( [ 1 for kwp in k["pattern"] if kwp in lowertext ] )
|
|
|
|
|
+ if matches==len(k["pattern"]):
|
|
|
self.WEIGHT_SUM+=k["weight"]
|
|
self.WEIGHT_SUM+=k["weight"]
|
|
|
self.MATCHING_KW.append(k["kw"])
|
|
self.MATCHING_KW.append(k["kw"])
|
|
|
self.MATCHES=True
|
|
self.MATCHES=True
|