Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 73093b6

Browse files
CipherCipher
authored andcommitted
POSSIBLY nearly fixed error
1 parent cba0c90 commit 73093b6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Janex/main.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,17 @@ def response_compare(self, input_string, intent_class):
110110
else:
111111
similarity += 1
112112

113-
# Calculate the similarity percentage and the distance
114-
similarity_percentage = similarity / len(overall_word_list) # Calculate average similarity
113+
distance = abs(len(response) - len(input_string)) / 1000
114+
115+
print(distance)
115116

116-
# Calculate the distance between response and input_string
117-
distance = abs(len(response) - len(input_string))
117+
similarity = similarity + distance
118118

119-
# Combine similarity and distance with appropriate weights
120-
# You can adjust the weights based on your preference
121-
combined_similarity = 0.2 * similarity_percentage + 0.8 * (1 - distance / max(len(response), len(input_string)))
119+
# Calculate the similarity percentage and the distance
120+
similarity_percentage = similarity / len(overall_word_list) # Calculate average similarity
122121

123-
if combined_similarity > highest_similarity:
124-
highest_similarity = combined_similarity
122+
if similarity > highest_similarity:
123+
highest_similarity = similarity
125124
most_similar_response = response
126125

127126
print(f"Similarity: {highest_similarity:.2%}")

0 commit comments

Comments
 (0)