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

Commit 66e1d59

Browse files
CipherCipher
authored andcommitted
Logic error fixed. Accuracy of intent class prediction and response prediction heightened.
1 parent 2df500a commit 66e1d59

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Janex.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def Tokenize(input_string):
88
input_string = input_string.strip()
99
input_string = input_string.translate(str.maketrans("", "", string.punctuation))
1010
words = input_string.split()
11+
1112
return words
1213

1314
def train(intents_file_path):
@@ -56,10 +57,10 @@ def patterncompare(input_string, intents_file_path):
5657
if word in WordList:
5758
Similarity = Similarity + 1
5859

59-
if Similarity > HighestSimilarity:
60-
SimilarityPercentage = Similarity / len(OverallWordList + WordList2)
61-
HighestSimilarity = Similarity
62-
MostSimilarPattern = intent_class
60+
if Similarity > HighestSimilarity:
61+
SimilarityPercentage = Similarity / len(OverallWordList + WordList2)
62+
HighestSimilarity = Similarity
63+
MostSimilarPattern = intent_class
6364

6465
print(f"Similarity: {SimilarityPercentage:.2f}%")
6566

@@ -110,10 +111,10 @@ def responsecompare(input_string, intents_file_path, intent_class):
110111
if word in WordList:
111112
Similarity = (Similarity+1/len(WordList + WordList2))
112113

113-
if Similarity > HighestSimilarity:
114-
SimilarityPercentage = Similarity * 100
115-
HighestSimilarity = Similarity
116-
MostSimilarResponse = response
114+
if Similarity > HighestSimilarity:
115+
SimilarityPercentage = Similarity * 100
116+
HighestSimilarity = Similarity
117+
MostSimilarResponse = response
117118

118119
print(f"Similarity: {SimilarityPercentage:.2f}%")
119120

@@ -130,7 +131,7 @@ def responsecompare(input_string, intents_file_path, intent_class):
130131
return MostSimilarResponse
131132

132133
def stem(input_word):
133-
suffixes = ['ing', 'ly', 'ed', 'es', 's', 'er', 'est', 'y', 'ily', 'able', 'ful', 'ness', 'less', 'ment', 'ive', 'ize', 'ous']
134+
suffixes = ['ing', 'ly', 'ed', 'es', "'s", 'er', 'est', 'y', 'ily', 'able', 'ful', 'ness', 'less', 'ment', 'ive', 'ize', 'ous']
134135
for suffix in suffixes:
135136
if input_word.endswith(suffix):
136137
input_word = input_word[:-len(suffix)]

__pycache__/Janex.cpython-311.pyc

155 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)