fix: [Term tracker] fix item date

pull/586/head
Terrtia 2022-02-16 10:19:53 +01:00
parent a75bf94a78
commit be1eaf0dc4
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
2 changed files with 9 additions and 8 deletions

View File

@ -71,13 +71,12 @@ class Tracker_Regex(AbstractModule):
uuid_list = Tracker.get_tracker_uuid_list(tracker, tracker_type) uuid_list = Tracker.get_tracker_uuid_list(tracker, tracker_type)
item_id = item.get_id() item_id = item.get_id()
item_date = item.get_date()
item_source = item.get_source()
print(f'new tracked regex found: {tracker} in {item_id}') print(f'new tracked regex found: {tracker} in {item_id}')
for tracker_uuid in uuid_list: for tracker_uuid in uuid_list:
# Source Filtering # Source Filtering
item_source = item.get_source()
item_date = item.get_date()
tracker_sources = Tracker.get_tracker_uuid_sources(tracker_uuid) tracker_sources = Tracker.get_tracker_uuid_sources(tracker_uuid)
if tracker_sources and item_source not in tracker_sources: if tracker_sources and item_source not in tracker_sources:
continue continue

View File

@ -94,13 +94,12 @@ class Tracker_Term(AbstractModule):
# create token statistics # create token statistics
# for word in dict_words_freq: # for word in dict_words_freq:
# Term.create_token_statistics(item_date, word, dict_words_freq[word]) # Term.create_token_statistics(item_date, word, dict_words_freq[word])
item_source = item.get_source()
# check solo words # check solo words
####### # TODO: check if source needed ####### ####### # TODO: check if source needed #######
for word in self.list_tracked_words: for word in self.list_tracked_words:
if word in dict_words_freq: if word in dict_words_freq:
self.new_term_found(word, 'word', item.get_id(), item_source) self.new_term_found(word, 'word', item)
# check words set # check words set
for elem in self.set_tracked_words_list: for elem in self.set_tracked_words_list:
@ -113,13 +112,16 @@ class Tracker_Term(AbstractModule):
if word in dict_words_freq: if word in dict_words_freq:
nb_uniq_word += 1 nb_uniq_word += 1
if nb_uniq_word >= nb_words_threshold: if nb_uniq_word >= nb_words_threshold:
self.new_term_found(word_set, 'set', item.get_id(), item_source) self.new_term_found(word_set, 'set', item)
def new_term_found(self, term, term_type, item_id, item_source): def new_term_found(self, term, term_type, item):
uuid_list = Term.get_term_uuid_list(term, term_type) uuid_list = Term.get_term_uuid_list(term, term_type)
item_id = item.get_id()
item_date = item.get_date()
item_source = item.get_source()
self.redis_logger.info(f'new tracked term found: {term} in {item_id}') self.redis_logger.info(f'new tracked term found: {term} in {item_id}')
print(f'new tracked term found: {term} in {item_id}') print(f'new tracked term found: {term} in {item_id}')
item_date = Item.get_date()
for term_uuid in uuid_list: for term_uuid in uuid_list:
tracker_sources = Tracker.get_tracker_uuid_sources(term_uuid) tracker_sources = Tracker.get_tracker_uuid_sources(term_uuid)
if not tracker_sources or item_source in tracker_sources: if not tracker_sources or item_source in tracker_sources: