Learn Language Manager

In [1]:
from xv.english import LearnLanguageManager
In [2]:
ke = LearnLanguageManager(verbose = False,
                         author = 'Thakur')
In [3]:
ke.printProblemTypes()
0. _problem_text_to_speech
1. _problem_text_translate_to_speech
2. _problem_write_and_translate
3. _problem_greetings_translate_to_speech
In [4]:
text = """
Hello, How do you do?
"""
In [5]:
ke.getRandomProblem(problem_type = 0, 
                    dest = 'hi',
                    #text = text.strip()
                   )
Out[5]:

Read the following text:


Florentino Ariza had kept his answer ready for fifty-three years, seven months, and eleven days and nights.

"Forever," he said.

Note: Pass the 'text' you want to read, like:


text = "How do you do?"
In [6]:
ke.listen()
Out[6]:
In [7]:
ke.printAnswer()
Out[7]:

Run the following code to hear text and then write it.


ke.listen()
In [8]:
ke.printSolution()
Out[8]:

Run the following code to hear text and then write it.


ke.listen()
In [9]:
from IPython.display import HTML
n = len(ke._problemTemplates)
max_loop = 1
for j in range(0, max_loop):
    for i in range(n):
        problem_type = i
        display(HTML(f"<h2>problem_type: {problem_type}/{n-1} (loop {j}/{max_loop-1})</h2>"))
        ke.getRandomProblem(problem_type = problem_type, verbose = True)
        display(ke.printProblem())

        display(HTML(f"<h6>Answer:</h6>"))
        display(ke.printAnswer())

        display(HTML(f"<h6>Solution:</h6>"))
        display(ke.printSolution())
        pass

problem_type: 0/3 (loop 0/0)

Problem Template: _problem_text_to_speech

Read the following text:


"The beer's nice and cool," the man said.

"It's lovely," the girl said.

"It's really an awfully simple operation, Jig," the man said. "It's not really an operation at all."

The girl looked at the ground the table legs rested on.

"I know you wouldn't mind it, Jig. It's really not anything. It's just to let the air in."

Note: Pass the 'text' you want to read, like:


text = "How do you do?"
Answer:

Run the following code to hear text and then write it.


ke.listen()
Solution:

Run the following code to hear text and then write it.


ke.listen()

problem_type: 1/3 (loop 0/0)

Problem Template: _problem_text_translate_to_speech

Convert the following text from en to hi and read:


"I'm sorry if I kept you awake last night. I was restless. I needed to take a walk."

"No, I went right to sleep," she said, which was not true.

"I tried to be quiet."

Note: Pass the 'text' you want to read, like:


text = "How do you do?"
Answer:

Run the following code to hear text and then write it.


ke.listen()
Solution:

Original Text (en)


"I'm sorry if I kept you awake last night. I was restless. I needed to take a walk."

"No, I went right to sleep," she said, which was not true.

"I tried to be quiet."

Translated Text (hi)


"मुझे खेद है अगर मैंने तुम्हें कल रात जगाया। मैं बेचैन था। मुझे टहलने की जरूरत थी।"

"नहीं, मैं सोने के लिए गई थी," उसने कहा, जो सच नहीं था।

"मैंने चुप रहने की कोशिश की।"

Note: Run the following code to hear text and then write it.


ke.listen()

problem_type: 2/3 (loop 0/0)

Problem Template: _problem_write_and_translate

Hear, write and translate into en.

Note: Code to listen:


ke.listen()

Note: Pass the 'text' you want to read, like:


text = "How do you do?"
Answer:

Original Text (hi)


"कोई आराम नहीं है। मैंने उसे मार डाला।"

मरियम की आवाज दृढ़ थी, अस्वाभाविक रूप से जोर से, लगभग उसके कान में चिल्ला रही थी। "आपने उसे नहीं मारा! अगर वह सदमे से मरने वाली होती तो यह तब होता जब आपने उसे पहली बार बंदूक दिखाई। आप नहीं जानते कि वह क्यों मरी। यह स्वाभाविक कारण था, यह होना चाहिए था। यह हो सकता था वैसे भी हुआ। वह बूढ़ी थी और उसका दिल कमजोर था। आपने हमें बताया। यह आपकी गलती नहीं थी, थियो, आपका मतलब यह नहीं था।"

उन्होंने कहा: "सबसे बुरी बात यह है कि मैंने इसका आनंद लिया। मैंने वास्तव में इसका आनंद लिया!"

मरियम कंबलों को कंधा मिलाकर कार को उतार रही थी। "उस बूढ़े आदमी और उसकी पत्नी को बांधने में मज़ा आया? बेशक आपको मज़ा नहीं आया। आपने वही किया जो आपको करना था।"

"बांधना नहीं। मेरा मतलब यह नहीं था। लेकिन मैंने उत्साह, शक्ति, ज्ञान का आनंद लिया जो मैं कर सकता था। यह सब भयानक नहीं था। यह उनके लिए था, लेकिन मेरे लिए नहीं।"

Translated Text (en)


"There is no comfort. I killed her."

Miriam's voice was firm, unnaturally loud, almost shouting in his ear. "You didn't kill her! If she was going to die of shock it would have happened when you first showed her the gun. You don't know why she died. It was natural causes, it must have been. It could have happened anyway. She was old and she had a weak heart. You told us. It wasn't your fault, Theo, you didn't mean it."

He said: "The worst is that I enjoyed it. I actually enjoyed it!"

Miriam was unloading the car, shouldering the blankets. "Enjoyed tying up that old man and his wife? Of course you didn't enjoy it. You did what you had to do."

"Not the tying up. I didn't mean that. But I enjoyed the excitement, the power, the knowledge that I could do it. It wasn't all horrible. It was for them, but not for me."
Solution:

Original Text (hi)


"कोई आराम नहीं है। मैंने उसे मार डाला।"

मरियम की आवाज दृढ़ थी, अस्वाभाविक रूप से जोर से, लगभग उसके कान में चिल्ला रही थी। "आपने उसे नहीं मारा! अगर वह सदमे से मरने वाली होती तो यह तब होता जब आपने उसे पहली बार बंदूक दिखाई। आप नहीं जानते कि वह क्यों मरी। यह स्वाभाविक कारण था, यह होना चाहिए था। यह हो सकता था वैसे भी हुआ। वह बूढ़ी थी और उसका दिल कमजोर था। आपने हमें बताया। यह आपकी गलती नहीं थी, थियो, आपका मतलब यह नहीं था।"

उन्होंने कहा: "सबसे बुरी बात यह है कि मैंने इसका आनंद लिया। मैंने वास्तव में इसका आनंद लिया!"

मरियम कंबलों को कंधा मिलाकर कार को उतार रही थी। "उस बूढ़े आदमी और उसकी पत्नी को बांधने में मज़ा आया? बेशक आपको मज़ा नहीं आया। आपने वही किया जो आपको करना था।"

"बांधना नहीं। मेरा मतलब यह नहीं था। लेकिन मैंने उत्साह, शक्ति, ज्ञान का आनंद लिया जो मैं कर सकता था। यह सब भयानक नहीं था। यह उनके लिए था, लेकिन मेरे लिए नहीं।"

Translated Text (en)


"There is no comfort. I killed her."

Miriam's voice was firm, unnaturally loud, almost shouting in his ear. "You didn't kill her! If she was going to die of shock it would have happened when you first showed her the gun. You don't know why she died. It was natural causes, it must have been. It could have happened anyway. She was old and she had a weak heart. You told us. It wasn't your fault, Theo, you didn't mean it."

He said: "The worst is that I enjoyed it. I actually enjoyed it!"

Miriam was unloading the car, shouldering the blankets. "Enjoyed tying up that old man and his wife? Of course you didn't enjoy it. You did what you had to do."

"Not the tying up. I didn't mean that. But I enjoyed the excitement, the power, the knowledge that I could do it. It wasn't all horrible. It was for them, but not for me."

problem_type: 3/3 (loop 0/0)

Problem Template: _problem_greetings_translate_to_speech
Greetings in en and hi:
Good morning, madam.
Good morning, sir. How are you?
I'm fine thanks, and you?
Not too bad. Meet my friend Shelly.
Pleased to meet you.
Pleased to meet you too. Are you from US, Shelly?
Yes, New York. And you, are you from India?
No, I'm from Bhutan, but I live in Delhi now.
Well, goodbye sir, it was nice to see you.
Yes, goodbye.
Answer:

Run the following code to hear text and then write it.


ke.listen()
Solution:

Original Text (en)


Good morning, madam.
Good morning, sir. How are you?
I'm fine thanks, and you?
Not too bad. Meet my friend Shelly.
Pleased to meet you.
Pleased to meet you too. Are you from US, Shelly?
Yes, New York. And you, are you from India?
No, I'm from Bhutan, but I live in Delhi now.
Well, goodbye sir, it was nice to see you.
Yes, goodbye.

Translated Text (hi)


सुप्रभात महोदया।
सुप्रभात सर। क्या हाल है?
धन्यवाद मैं ठीक हूँ, आप कैसे हैं?
इतना भी बेकार नहीं। मेरे दोस्त शैली से मिलो।
आपसे मिलकर खुशी हुई।
आप से मिलकर भी बहुत ख़ुशी हुई। क्या आप अमेरिका से हैं, शैली?
हाँ, न्यूयॉर्क। और आप, क्या आप भारत से हैं?
नहीं, मैं भूटान से हूं, लेकिन मैं अभी दिल्ली में रहता हूं।
खैर, अलविदा सर, आपको देखकर अच्छा लगा।
हाँ, अलविदा।

Note: Run the following code to hear text and then write it.


ke.listen()
In [ ]:
 

Machine Learning

  1. Deal Banking Marketing Campaign Dataset With Machine Learning

TensorFlow

  1. Difference Between Scalar, Vector, Matrix and Tensor
  2. TensorFlow Deep Learning Model With IRIS Dataset
  3. Sequence to Sequence Learning With Neural Networks To Perform Number Addition
  4. Image Classification Model MobileNet V2 from TensorFlow Hub
  5. Step by Step Intent Recognition With BERT
  6. Sentiment Analysis for Hotel Reviews With NLTK and Keras
  7. Simple Sequence Prediction With LSTM
  8. Image Classification With ResNet50 Model
  9. Predict Amazon Inc Stock Price with Machine Learning
  10. Predict Diabetes With Machine Learning Algorithms
  11. TensorFlow Build Custom Convolutional Neural Network With MNIST Dataset
  12. Deal Banking Marketing Campaign Dataset With Machine Learning

PySpark

  1. How to Parallelize and Distribute Collection in PySpark
  2. Role of StringIndexer and Pipelines in PySpark ML Feature - Part 1
  3. Role of OneHotEncoder and Pipelines in PySpark ML Feature - Part 2
  4. Feature Transformer VectorAssembler in PySpark ML Feature - Part 3
  5. Logistic Regression in PySpark (ML Feature) with Breast Cancer Data Set

PyTorch

  1. Build the Neural Network with PyTorch
  2. Image Classification with PyTorch
  3. Twitter Sentiment Classification In PyTorch
  4. Training an Image Classifier in Pytorch

Natural Language Processing

  1. Spelling Correction Of The Text Data In Natural Language Processing
  2. Handling Text For Machine Learning
  3. Extracting Text From PDF File in Python Using PyPDF2
  4. How to Collect Data Using Twitter API V2 For Natural Language Processing
  5. Converting Text to Features in Natural Language Processing
  6. Extract A Noun Phrase For A Sentence In Natural Language Processing