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

Commit f548eb7

Browse files
author
Cipher
committed
Did some things
1 parent 8abae3d commit f548eb7

File tree

4 files changed

+14613
-30
lines changed

4 files changed

+14613
-30
lines changed

Janex.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ def patterncompare(input_string, intents_file_path):
3737
SimilarityPercentage = Similarity * 100
3838

3939
if Similarity > MaxSimilarity:
40-
print(f"Similarity: {SimilarityPercentage:.2f}%")
4140
MaxSimilarity = Similarity
4241
MostSimilarPattern = intent_class
42+
43+
if SimilarityPercentage > 100:
44+
SimilarityPercentage = SimilarityPercentage/100
45+
46+
print(f"Similarity: {SimilarityPercentage:.2f}%")
4347

4448
if MostSimilarPattern:
4549
return MostSimilarPattern
@@ -72,18 +76,21 @@ def responsecompare(input_string, intents_file_path, intent_class):
7276
for OutputWord in WordList:
7377
if InputWord == OutputWord:
7478
Similarity += 1
75-
print("Match found!")
79+
# print("Match found!")
7680

7781
OutofHundred = len(BagOfWords) # Total number of words in the input
7882
Hundred = len(BagOfWords + WordList) # Total number of words in both input and pattern
7983

8084
SimilarityPercentage = (Similarity / Hundred) * 100 # Corrected calculation
81-
82-
print(f"Similarity: {SimilarityPercentage:.2f}%")
8385

8486
if Similarity > MaxSimilarity:
8587
MaxSimilarity = Similarity
8688
MostSimilarResponse = response
89+
90+
if SimilarityPercentage > 100:
91+
SimilarityPercentage = SimilarityPercentage/100
92+
93+
print(f"Similarity: {SimilarityPercentage:.2f}%")
8794

8895
# Convert MSR back into original string
8996
for response in responses:

__pycache__/Janex.cpython-311.pyc

35 Bytes
Binary file not shown.

chat.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@
44

55
words = Tokenize(input_string)
66

7-
print(words)
8-
97
intents_file_path = "intents.json"
108

119
intent_class = patterncompare(input_string, intents_file_path)
1210

13-
print(intent_class)
14-
1511
BestResponse = responsecompare(input_string, intents_file_path, intent_class)
1612

1713
print(BestResponse)

0 commit comments

Comments
 (0)