Skip to content

Instantly share code, notes, and snippets.

@hmhard
Created April 22, 2023 15:44
Show Gist options
  • Save hmhard/5cf258e5f3eb5bbd7f1d728481749827 to your computer and use it in GitHub Desktop.
Save hmhard/5cf258e5f3eb5bbd7f1d728481749827 to your computer and use it in GitHub Desktop.
text translator script
from textblob import TextBlob
text="there are a lot of books in my bag"
while text:
text=input("enter text")
if text is None:
break
blob= TextBlob(text)
print(blob.detect_language())
if blob.detect_language()== 'en':
print(blob.translate(to='am'))
else:
print(blob.translate(to='en'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment