chg: [description_value] reprocess clusters to avoid duplicate on value

pull/875/head
Alexandre Dulaunoy 2023-10-13 18:36:13 +02:00
parent 6f1b8344a5
commit fe77114b84
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 27 additions and 0 deletions

27
tools/description_value.py Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python3
# coding=utf-8
"""
Tool to remove duplicates in value
"""
import sys
import json
with open(sys.argv[1], 'r') as f:
data = json.load(f)
#for c in data['values']:
# c['value'] = f'{c["value"]} - {c["meta"]["description"]}'
value_seen = []
data_output = []
for c in data['values']:
if c['value'] in value_seen:
continue
else:
data_output.append(c)
value_seen.append(c['value'])
data['values'] = data_output
with open(sys.argv[1], 'w') as f:
json.dump(data, f)