Skip to content

Commit

Permalink
lingva: Fix handling of missing output parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeedali committed Dec 11, 2023
1 parent dec9197 commit 7789543
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dialect/providers/modules/lingva.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def init_tts(self, on_done, on_fail):
def translate(self, text, src, dest, on_done, on_fail):
def on_response(data):
try:
detected = data['info'].get('detectedSource', None)
mistakes = data['info'].get('typo', None)
src_pronunciation = data['info']['pronunciation'].get('query', None)
dest_pronunciation = data['info']['pronunciation'].get('translation', None)
detected = data.get('info', {}).get('detectedSource', None)
mistakes = data.get('info', {}).get('typo', None)
src_pronunciation = data.get('info', {}).get('pronunciation', {}).get('query', None)
dest_pronunciation = data.get('info', {}).get('pronunciation', {}).get('translation', None)

translation = Translation(
data['translation'],
Expand Down

0 comments on commit 7789543

Please sign in to comment.