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

Commit 6326ce1

Browse files
author
Cipher
committed
New whls
1 parent 0bed0be commit 6326ce1

File tree

7 files changed

+35
-19
lines changed

7 files changed

+35
-19
lines changed

Janex.egg-info/PKG-INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Metadata-Version: 2.1
22
Name: Janex
3-
Version: 0.0.9
3+
Version: 0.0.11
44
Home-page: https://github.com/Cipher58
5-
Download-URL: https://github.com/Cipher58/Janex/archive/refs/tags/v0.0.2-beta.tar.gz
5+
Download-URL: https://github.com/Cipher58/Janex/
66
Author: Cipher58
77
Author-email: [email protected]
88
License: Lily 1.0

build/lib/Janex/main.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def pattern_compare(self, input_string):
6565
highest_similarity = similarity
6666
most_similar_pattern = intent_class
6767

68-
print(f"Similarity: {similarity_percentage:.2%}")
68+
# print(f"Similarity: {similarity_percentage:.2%}")
6969

7070
if most_similar_pattern:
7171
highest_similarity = highest_similarity / 100
@@ -77,12 +77,15 @@ def response_compare(self, input_string, intent_class):
7777
input_string_lower = input_string.lower()
7878
highest_similarity = 0
7979
similarity_percentage = 0
80+
distance = 0
8081
most_similar_response = None
8182

8283
responses = intent_class["responses"] if intent_class else []
8384

8485
for response in responses:
8586
similarity = 0
87+
Count = 0
88+
InputCount = 0
8689
response_lower = response.lower()
8790
word_list = self.tokenize(response_lower)
8891
new_list = []
@@ -103,24 +106,36 @@ def response_compare(self, input_string, intent_class):
103106

104107
for word in word_list_2:
105108
if word in word_list:
106-
similarity += 1
109+
# Check if the word begins with a capital letter
110+
if word.istitle():
111+
similarity += 2 # Add 2 to the similarity for words with capital letters
112+
else:
113+
similarity += 1
114+
115+
response_words = self.tokenize(response)
116+
input_words = self.tokenize(input_string)
117+
118+
for word in response_words:
119+
Count += 0.01
120+
121+
for word in input_words:
122+
InputCount += 0.01
123+
124+
distance = Count + InputCount / 2
125+
126+
# print(distance)
127+
128+
similarity = similarity - distance
129+
130+
# Calculate the similarity percentage and the distance
131+
similarity_percentage = similarity / len(overall_word_list) # Calculate average similarity
107132

108133
if similarity > highest_similarity:
109-
similarity_percentage = similarity / (len(overall_word_list) + len(word_list_2))
110134
highest_similarity = similarity
111135
most_similar_response = response
112136

113-
print(f"Similarity: {similarity_percentage:.2%}")
114-
115-
# Convert most_similar_response back into the original string
116-
for response in responses:
117-
low_response_list = []
118-
low_response = response.lower()
119-
low_response_list = self.stem_sentence(low_response)
120-
121-
for low_response_word in low_response_list:
122-
if low_response_word == most_similar_response:
123-
most_similar_response = response
137+
# print(f"Similarity: {similarity_percentage:.2%}")
138+
# print(f"Distance: {distance}")
124139

125140
return most_similar_response
126141

@@ -135,9 +150,10 @@ def stem(self, input_word):
135150
def stem_sentence(self, input_string):
136151
word_list = input_string.split(" ")
137152
stemmed_words = []
153+
138154
for input_word in word_list:
139155
word = self.stem(input_word)
140-
stemmed_words.append(word)
156+
stemmed_word.append(word)
141157

142158
return stemmed_words
143159

dist/Janex-0.0.10-py3-none-any.whl

7.25 KB
Binary file not shown.

dist/Janex-0.0.10.tar.gz

5.62 KB
Binary file not shown.

dist/Janex-0.0.11-py3-none-any.whl

7.23 KB
Binary file not shown.

dist/Janex-0.0.11.tar.gz

5.57 KB
Binary file not shown.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
name="Janex",
99

1010
# version of the module
11-
version="0.0.10",
11+
version="0.0.11",
1212

1313
# Name of Author
1414
author="Cipher58",
1515

16-
download_url = 'https://github.com/Cipher58/Janex/archive/refs/tags/v0.0.2-beta.tar.gz',
16+
download_url = 'https://github.com/Cipher58/Janex/',
1717

1818
# your Email address
1919
author_email="[email protected]",

0 commit comments

Comments
 (0)