Skip to main content

Make a Translator using python?





CODE :

pip install translate

create a new script file eg. english in the same directory.

from translate import Translator
translator=Translator(to_lang="hi")
with open ('./english.txt','r') as file2:
    text=file2.read()
    translation=translator.translate(text)
    print(translation)


or another way 


jj=str(input('enter th english'))
from translate import Translator
translator=Translator(to_lang="hi")
with open ('./english.txt','w') as file2:
    file2.write(f'--{jj}')
with open('./english.txt', 'r') as file2:
    text = file2.read()
    translation=translator.translate(text)
    print(translation)
DEMO:




Comments

Popular posts from this blog

Image Identify using machine learning in Python.

#pip install imageai #pip install Tensorflow #pip install keras from  imageai.Prediction  import  ImagePrediction import  os from  keras.models  import  load_model Givenimage= "picc.jpg" execution_path=os.getcwd() #print(execution_path) prediction = ImagePrediction() prediction.setModelTypeAsSqueezeNet() prediction.setModelPath(os.path.join(execution_path,  "squeezenet_weights_tf_dim_ordering_tf_kernels.h5" )) prediction.loadModel() predictions, probabilities = prediction.predictImage(os.path.join(execution_path, Givenimage), result_count= 3  ) for  eachPrediction, eachProbability  in   zip (predictions, probabilities):      print (eachPrediction ,  " : "  , eachProbability)   Result: WARNING:tensorflow:11 out of the last 11 calls to <function Model.make_predict_function.<locals>.predict_function at 0x7f941e211598> tr...

How to make dice game by using LabVIEW?

8. Dice Game (Exercise) In a board game a pair of dice (one is 6 sided and the other is 12 sided) is rolled. You win when there is a matching number, or the sum of the numbers rolled is equal to 18. In this problem we would like to build a VI that will do the following: i) Rolls the pair of dice every 100ms and displays the numbers rolled ii) A digital indicator displays the number of times dice rolled iii) An LED glows when you win iv) A digital indicator displays the number of wins v) Program stops after exactly100 rolls.