Skip to content

Commit

Permalink
fix context lang
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Feb 19, 2024
1 parent 29c33e0 commit ddaf9a8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def handle_search(self, message):
@intent_handler("definition.intent")
def handle_definition(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("definition")
res = self.wordnet.search(query, context={"lang": self.lang}).get("definition")
if res:
self.speak(res)
else:
Expand All @@ -45,7 +45,7 @@ def handle_definition(self, message):
@intent_handler("lemma.intent")
def handle_lemma(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("lemmas")
res = self.wordnet.search(query, context={"lang": self.lang}).get("lemmas")
if res:
self.speak(random.choice(res))
else:
Expand All @@ -54,7 +54,7 @@ def handle_lemma(self, message):
@intent_handler("antonym.intent")
def handle_antonym(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("antonyms")
res = self.wordnet.search(query, context={"lang": self.lang}).get("antonyms")
if res:
self.speak(random.choice(res))
else:
Expand All @@ -63,7 +63,7 @@ def handle_antonym(self, message):
@intent_handler("holonym.intent")
def handle_holonym(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("holonyms")
res = self.wordnet.search(query, context={"lang": self.lang}).get("holonyms")
if res:
self.speak(random.choice(res))
else:
Expand All @@ -72,7 +72,7 @@ def handle_holonym(self, message):
@intent_handler("hyponym.intent")
def handle_hyponym(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("hyponyms")
res = self.wordnet.search(query, context={"lang": self.lang}).get("hyponyms")
if res:
self.speak(random.choice(res))
else:
Expand All @@ -81,7 +81,7 @@ def handle_hyponym(self, message):
@intent_handler("hypernym.intent")
def handle_hypernym(self, message):
query = message.data["query"]
res = self.wordnet.search(query, lang=self.lang).get("hypernyms")
res = self.wordnet.search(query, context={"lang": self.lang}).get("hypernyms")
if res:
self.speak(random.choice(res))
else:
Expand All @@ -107,7 +107,7 @@ def CQS_action(self, phrase, data):

query = "what is the definition of computer"

ans = d.wordnet.search("computer")
ans = d.wordnet.search("computer", context={"lang": "es-es"})
print(ans)
# {'lemmas': ['computer', 'computing machine', 'computing device', 'data processor', 'electronic computer', 'information processing system'],
# 'antonyms': [],
Expand Down

0 comments on commit ddaf9a8

Please sign in to comment.