Spaces:
Configuration error
Configuration error
Upload tool
Browse files
tool.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from smolagents.tools import Tool
|
2 |
-
import json
|
3 |
-
import pronouncing
|
4 |
import string
|
|
|
|
|
5 |
|
6 |
class ParodyWordSuggestionTool(Tool):
|
7 |
name = "parody_word_suggester"
|
@@ -257,6 +257,7 @@ class ParodyWordSuggestionTool(Tool):
|
|
257 |
target_phone_list = target_phones.split()
|
258 |
target_vowel, target_end = self._get_last_syllable(target_phone_list)
|
259 |
|
|
|
260 |
# Check each word
|
261 |
for word in valid_words:
|
262 |
word_phones = self._get_word_phones(word, custom_phones)
|
@@ -270,12 +271,11 @@ class ParodyWordSuggestionTool(Tool):
|
|
270 |
suggestions.append({
|
271 |
"word": word,
|
272 |
"similarity": similarity_result["similarity"],
|
273 |
-
"
|
274 |
-
"
|
275 |
-
"
|
276 |
-
"
|
277 |
-
"
|
278 |
-
"suffix_match": similarity_result["suffix_match"],
|
279 |
"phones": word_phones,
|
280 |
"last_vowel": word_vowel,
|
281 |
"ending": " ".join(word_end) if word_end else "",
|
|
|
1 |
from smolagents.tools import Tool
|
|
|
|
|
2 |
import string
|
3 |
+
import pronouncing
|
4 |
+
import json
|
5 |
|
6 |
class ParodyWordSuggestionTool(Tool):
|
7 |
name = "parody_word_suggester"
|
|
|
257 |
target_phone_list = target_phones.split()
|
258 |
target_vowel, target_end = self._get_last_syllable(target_phone_list)
|
259 |
|
260 |
+
# Check each word
|
261 |
# Check each word
|
262 |
for word in valid_words:
|
263 |
word_phones = self._get_word_phones(word, custom_phones)
|
|
|
271 |
suggestions.append({
|
272 |
"word": word,
|
273 |
"similarity": similarity_result["similarity"],
|
274 |
+
"vowel_score": similarity_result["vowel_score"],
|
275 |
+
"consonant_score": similarity_result["consonant_score"],
|
276 |
+
"pattern_score": similarity_result["pattern_score"],
|
277 |
+
"primary_vowels": similarity_result["primary_vowels"],
|
278 |
+
"consonants": similarity_result["consonants"],
|
|
|
279 |
"phones": word_phones,
|
280 |
"last_vowel": word_vowel,
|
281 |
"ending": " ".join(word_end) if word_end else "",
|