mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-27 00:07:16 +00:00
Suppressed prints
This commit is contained in:
parent
2fd2c8af39
commit
20fd191c20
1 changed files with 0 additions and 14 deletions
|
@ -33,7 +33,6 @@ size_threshold = 250
|
||||||
line_max_length_threshold = 1000
|
line_max_length_threshold = 1000
|
||||||
|
|
||||||
def Analyse(message, server):
|
def Analyse(message, server):
|
||||||
#print 'analyzing'
|
|
||||||
path = message
|
path = message
|
||||||
paste = Paste.Paste(path)
|
paste = Paste.Paste(path)
|
||||||
|
|
||||||
|
@ -50,19 +49,13 @@ def Analyse(message, server):
|
||||||
|
|
||||||
if p_MimeType in accepted_Mime_type:
|
if p_MimeType in accepted_Mime_type:
|
||||||
|
|
||||||
print 'Processing', path
|
|
||||||
the_date = datetime.date(int(p_date[0:4]), int(p_date[4:6]), int(p_date[6:8]))
|
the_date = datetime.date(int(p_date[0:4]), int(p_date[4:6]), int(p_date[6:8]))
|
||||||
#print 'pastedate: ', the_date
|
|
||||||
the_time = datetime.datetime.now()
|
the_time = datetime.datetime.now()
|
||||||
the_time = datetime.time(getattr(the_time, 'hour'), 0, 0)
|
the_time = datetime.time(getattr(the_time, 'hour'), 0, 0)
|
||||||
#print 'now: ', the_time
|
|
||||||
combined_datetime = datetime.datetime.combine(the_date, the_time)
|
combined_datetime = datetime.datetime.combine(the_date, the_time)
|
||||||
#print 'combined: ', combined_datetime
|
|
||||||
timestamp = calendar.timegm(combined_datetime.timetuple())
|
timestamp = calendar.timegm(combined_datetime.timetuple())
|
||||||
#print 'timestamp: ', timestamp
|
|
||||||
|
|
||||||
sentences = tokenize.sent_tokenize(p_content.decode('utf-8', 'ignore'))
|
sentences = tokenize.sent_tokenize(p_content.decode('utf-8', 'ignore'))
|
||||||
#print len(sentences)
|
|
||||||
|
|
||||||
if len(sentences) > 0:
|
if len(sentences) > 0:
|
||||||
avg_score = {'neg': 0.0, 'neu': 0.0, 'pos': 0.0, 'compoundPos': 0.0, 'compoundNeg': 0.0}
|
avg_score = {'neg': 0.0, 'neu': 0.0, 'pos': 0.0, 'compoundPos': 0.0, 'compoundNeg': 0.0}
|
||||||
|
@ -82,7 +75,6 @@ def Analyse(message, server):
|
||||||
else:
|
else:
|
||||||
avg_score[k] += ss[k]
|
avg_score[k] += ss[k]
|
||||||
|
|
||||||
#print('{0}: {1}, '.format(k, ss[k]))
|
|
||||||
|
|
||||||
for k in avg_score:
|
for k in avg_score:
|
||||||
if k == 'compoundPos':
|
if k == 'compoundPos':
|
||||||
|
@ -99,16 +91,13 @@ def Analyse(message, server):
|
||||||
# (UniqID_i -> PasteValue_i)
|
# (UniqID_i -> PasteValue_i)
|
||||||
|
|
||||||
server.sadd('Provider_set', provider)
|
server.sadd('Provider_set', provider)
|
||||||
#print 'Provider_set', provider
|
|
||||||
|
|
||||||
provider_timestamp = provider + '_' + str(timestamp)
|
provider_timestamp = provider + '_' + str(timestamp)
|
||||||
#print provider_timestamp
|
|
||||||
server.incr('UniqID')
|
server.incr('UniqID')
|
||||||
UniqID = server.get('UniqID')
|
UniqID = server.get('UniqID')
|
||||||
print provider_timestamp, '->', UniqID, 'dropped', num_line_removed, 'lines'
|
print provider_timestamp, '->', UniqID, 'dropped', num_line_removed, 'lines'
|
||||||
server.sadd(provider_timestamp, UniqID)
|
server.sadd(provider_timestamp, UniqID)
|
||||||
server.set(UniqID, avg_score)
|
server.set(UniqID, avg_score)
|
||||||
#print UniqID, '->', avg_score
|
|
||||||
else:
|
else:
|
||||||
print 'Dropped:', p_MimeType
|
print 'Dropped:', p_MimeType
|
||||||
|
|
||||||
|
@ -143,15 +132,12 @@ if __name__ == '__main__':
|
||||||
port=p.config.get("Redis_Level_DB_Sentiment", "port"),
|
port=p.config.get("Redis_Level_DB_Sentiment", "port"),
|
||||||
db=p.config.get("Redis_Level_DB_Sentiment", "db"))
|
db=p.config.get("Redis_Level_DB_Sentiment", "db"))
|
||||||
|
|
||||||
# Endless loop getting messages from the input queue
|
|
||||||
while True:
|
while True:
|
||||||
# Get one message from the input queue
|
|
||||||
message = p.get_from_set()
|
message = p.get_from_set()
|
||||||
if message is None:
|
if message is None:
|
||||||
publisher.debug("{} queue is empty, waiting".format(config_section))
|
publisher.debug("{} queue is empty, waiting".format(config_section))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Do something with the message from the queue
|
|
||||||
Analyse(message, server)
|
Analyse(message, server)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue