I want to try to get match values from the two arrays I input. I use Fuzzy for that. but I still can't get that value, maybe because the input form is an array. help me, please :)
Thank you and I'm sorry if my question does not clear. Thank you :)
a = [
[
"nyeri",
"tekan"
],
[
"nyeri",
"pada",
"kulit"
],
[
"demam"
]
]
b = [
[
"nyeri",
"tekan"
],
[
"pembengkakan",
"pada",
"kulit"
],
[
"demam",
"tinggi"
]
]
I tried the following code :
c = []
for i in range(0, len(a)):
for j in range(0, len(b):
Matching = fuzz.ratio(a,b)
if len(a) == len(b) and Matching == 100:
c.append([a, 'value:', 1])
elif len(a) != len(b) and 90 <= Matching <= 99:
c.append([a, 'value:', 0.8])
elif len(a) != len(b) and 80 <= Matching <= 89:
c.append([a, 'value:', 0.7])
elif len(a) != len(b) and 70 <= Matching <= 79:
c.append([a, 'value:', 0.6])
elif len(a) != len(b) and 0 <= Matching <= 69:
c.append([a, 'value:', 0])
return jsonify(c)
expected result :
[
[
"nyeri",
"tekan"
],
"value:", 1
[
"nyeri",
"pada",
"kulit"
],
"value:", 0
[
"demam"
],
"value:", 0
]
Can someone help?
question from:
https://stackoverflow.com/questions/65839889/how-to-match-use-fuzz-with-array-input 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…