Commit 7240c7e8 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Remake function for similar tags

parent 7cf0a47e
...@@ -17,8 +17,17 @@ class MLDataMaker: ...@@ -17,8 +17,17 @@ class MLDataMaker:
return tags.split(replace) return tags.split(replace)
return tags.split(char) return tags.split(char)
def is_tag_exist(self, tags, news_tags): def is_tag_similar(self, tags, news_tags):
return any(tag in news_tags for tag in tags) count = 0
for i in tags:
if i in news_tags:
count += 1
if count == 0 or count < len(tags) // 2:
return False
else:
return True
def make_ml_data(self, news, tags): def make_ml_data(self, news, tags):
ml_data = list() ml_data = list()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment