From 6a6763d4800beeb25ef625a9b6f32403acec3a36 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Tue, 16 Jan 2024 20:31:05 +0100 Subject: [PATCH] corrected bug for word in '' gives always true --- fdb_spider_interface.py | 38 +++--- new_message_file.txt | 2 +- roomhistories/657c97e5ebb39dd248d38d51.txt | 134 ++------------------- 3 files changed, 30 insertions(+), 144 deletions(-) diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index 4c0a12f..50cf3e3 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -552,50 +552,54 @@ if __name__ == '__main__': ntag_count = 0 for nword in name_data_lower: for ntag in ntags: - if ntag.lower() in nword: + if ntag.lower() in nword and nword != '': ntag_count += 1 if ntag_count == ntags_length: contains_tag = True - tag_list.append(tag + ' in name') + tag_list.append(ntags.join('_') + ' in name') ntag_count = 0 for iword in info_data_lower: for ntag in ntags: - if ntag.lower() in iword: + if ntag.lower() in iword and iword != '': ntag_count += 1 if ntag_count == ntags_length: contains_tag = True - tag_list.append(tag + ' in info') + tag_list.append(ntags.join('_') + ' in info') ntag_count = 0 for tword in text_data_lower: ntag_count = 0 for ntag in ntags: - if ntag.lower() in tword: + if ntag.lower() in tword and tword != '': ntag_count += 1 if ntag_count == ntags_length: contains_tag = True - tag_list.append(tag + ' in text') + tag_list.append(ntags.join('_') + ' in text') - #print('------------------') - #print(name_data_lower, info_data_lower, text_data_lower, room[0], room_tags) - else: - for tag in eval(room_tags): + else: + #print('------------------') + #print(name_data_lower, info_data_lower, text_data_lower, room[0], room_tags) for nword in name_data_lower: - if tag.lower() in nword: + if tag.lower() in nword and nword != '': contains_tag = True - tag_list.append(tag + ' in name') + if contains_tag == True: + tag_list.append(tag + ' in name') for iword in info_data_lower: - if tag.lower() in iword: + if tag.lower() in iword and iword != '': contains_tag = True - tag_list.append(tag + ' in info') - for tword in text_data_lower: - if tag.lower() in tword: + if contains_tag == True: + tag_list.append(tag + ' in info') + for tword in text_data_lower:: + if tag.lower() in tword and tword != '': contains_tag = True - tag_list.append(tag + ' in text') + if contains_tag == True: + tag_list.append(tag + ' in text') if contains_tag == True: + print('------------------') + print(name_data_lower, info_data_lower, text_data_lower) try: url = data[room_fdb][i][key]["domain"] except: diff --git a/new_message_file.txt b/new_message_file.txt index 0f2383e..d78cb00 100644 --- a/new_message_file.txt +++ b/new_message_file.txt @@ -1 +1 @@ -updaterooms 65817095ebb39dd248d4412b§%§%mJkq7PYpcaZYEDjNp \ No newline at end of file +updaterooms 657c97e5ebb39dd248d38d51§%§%awNMcpqH8ZhCc3Cx6 \ No newline at end of file diff --git a/roomhistories/657c97e5ebb39dd248d38d51.txt b/roomhistories/657c97e5ebb39dd248d38d51.txt index 5551ee3..b564827 100644 --- a/roomhistories/657c97e5ebb39dd248d38d51.txt +++ b/roomhistories/657c97e5ebb39dd248d38d51.txt @@ -1,126 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + +