DebasishDhal99
commited on
Commit
·
683a07d
1
Parent(s):
b776334
Adding option for random sentences in all languages.
Browse files
app.py
CHANGED
@@ -41,8 +41,10 @@ from googletrans import Translator
|
|
41 |
import re
|
42 |
from nltk.tokenize import word_tokenize
|
43 |
|
|
|
|
|
|
|
44 |
def random_sentence(lang):
|
45 |
-
translator = Translator()
|
46 |
sentence=gen.sentence() #Generates a random but coherent sentence in English
|
47 |
return translator.translate(sentence,dest=lang) #Translates the sentence to target language
|
48 |
|
|
|
41 |
import re
|
42 |
from nltk.tokenize import word_tokenize
|
43 |
|
44 |
+
gen = DocumentGenerator()
|
45 |
+
translator = Translator()
|
46 |
+
|
47 |
def random_sentence(lang):
|
|
|
48 |
sentence=gen.sentence() #Generates a random but coherent sentence in English
|
49 |
return translator.translate(sentence,dest=lang) #Translates the sentence to target language
|
50 |
|