pull/34/head
Jen Looper 4 years ago
parent 50f2b2bd93
commit 58c0751243

@ -1,8 +1,8 @@
# Translation and Sentiment Analysis with ML # Translation and Sentiment Analysis with ML
In the previous lessons you learned how to build a basic bot using TextBlob, a library that embeds ML behind-the-scenes to perform basic NLP tasks such as noun phrase extraction. Another important challenge in computational linguistics is accurate *translation* of a sentence from one spoken or written language to another. In the previous lessons you learned how to build a basic bot using TextBlob, a library that embeds ML behind-the-scenes to perform basic NLP tasks such as noun phrase extraction. Another important challenge in computational linguistics is accurate *translation* of a sentence from one spoken or written language to another.
## [Pre-lecture quiz](https://jolly-sea-0a877260f.azurestaticapps.net/quiz/33/)
## [Pre-lecture quiz](link-to-quiz-app)
This is a very hard problem compounded by the fact that there are thousands of languages and each can have very different grammar rules. One approach is to convert the formal grammar rules for one language, such as English, into a non-language dependent structure, and then translate it by converting back to another language. This means that you would take the following steps: This is a very hard problem compounded by the fact that there are thousands of languages and each can have very different grammar rules. One approach is to convert the formal grammar rules for one language, such as English, into a non-language dependent structure, and then translate it by converting back to another language. This means that you would take the following steps:
@ -44,7 +44,7 @@ TextBlob does a pretty good job at the translation: "C'est une vérité universe
I would argue that TextBlob's translation is far more exact, in fact, than the 1932 French translation of the book by V. Leconte and Ch. Pressoir: I would argue that TextBlob's translation is far more exact, in fact, than the 1932 French translation of the book by V. Leconte and Ch. Pressoir:
"C'est une vérité universelle qu'un celibataire pourvu d'une belle fortune doit avoir envie de se marier, et, si peu que l'on sache de son sentiment à cet egard, lorsqu'il arrive dans une nouvelle residence, cette idee est si bien fixée dans l'esprit de ses voisins qu'ils le considèrent sur-le-champ comme la propriété légitime de l'une ou l'autre de leurs filles." "C'est une vérité universelle qu'un celibataire pourvu d'une belle fortune doit avoir envie de se marier, et, si peu que l'on sache de son sentiment à cet egard, lorsqu'il arrive dans une nouvelle residence, cette idée est si bien fixée dans l'esprit de ses voisins qu'ils le considèrent sur-le-champ comme la propriété légitime de l'une ou l'autre de leurs filles."
In this case, the translation informed by ML does a better job than the human translator who is unnecessarily putting words in the original author's mouth for 'clarity'. In this case, the translation informed by ML does a better job than the human translator who is unnecessarily putting words in the original author's mouth for 'clarity'.
@ -138,7 +138,7 @@ Here is a sample [solution](solutions/book.py).
Can you make Marvin even better by extracting other features from the user input? Can you make Marvin even better by extracting other features from the user input?
## [Post-lecture quiz](link-to-quiz-app) ## [Pre-lecture quiz](https://jolly-sea-0a877260f.azurestaticapps.net/quiz/34/)
## Review & Self Study ## Review & Self Study

@ -1769,49 +1769,53 @@
"title": "NLP and Translation: Pre-Lecture Quiz", "title": "NLP and Translation: Pre-Lecture Quiz",
"quiz": [ "quiz": [
{ {
"questionText": "q1", "questionText": "Naive translation",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "translates words only",
"isCorrect": "false" "isCorrect": "true"
}, },
{ {
"answerText": "b", "answerText": "translates sentence structure",
"isCorrect": "true" "isCorrect": "false"
}, },
{ {
"answerText": "c", "answerText": "translates sentiment",
"isCorrect": "false" "isCorrect": "false"
} }
] ]
}, },
{ {
"questionText": "q2", "questionText": "A *corpus* of texts refers to",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "A small number of texts",
"isCorrect": "false"
},
{
"answerText": "A large number of texts",
"isCorrect": "true" "isCorrect": "true"
}, },
{ {
"answerText": "b", "answerText": "One standard text",
"isCorrect": "false" "isCorrect": "false"
} }
] ]
}, },
{ {
"questionText": "q3", "questionText": "If a ML model has enough human translations to build a model on, it can",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "abbreviate translations",
"isCorrect": "false" "isCorrect": "false"
}, },
{ {
"answerText": "b", "answerText": "standardize translations",
"isCorrect": "true" "isCorrect": "false"
}, },
{ {
"answerText": "c", "answerText": "improve the accuracy of translations",
"isCorrect": "false" "isCorrect": "true"
} }
] ]
} }
@ -1822,48 +1826,52 @@
"title": "NLP and Translation: Post-Lecture Quiz", "title": "NLP and Translation: Post-Lecture Quiz",
"quiz": [ "quiz": [
{ {
"questionText": "q1", "questionText": "Underlying TextBlob's translation library is:",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "Google Translate",
"isCorrect": "false" "isCorrect": "true"
}, },
{ {
"answerText": "b", "answerText": "Bing",
"isCorrect": "true" "isCorrect": "false"
}, },
{ {
"answerText": "c", "answerText": "A custom ML model",
"isCorrect": "false" "isCorrect": "false"
} }
] ]
}, },
{ {
"questionText": "q2", "questionText": "To use `blob.translate` you need:",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "an internet connection",
"isCorrect": "true" "isCorrect": "true"
}, },
{ {
"answerText": "b", "answerText": "a dictionary",
"isCorrect": "false"
},
{
"answerText": "JavaScript",
"isCorrect": "false" "isCorrect": "false"
} }
] ]
}, },
{ {
"questionText": "q3", "questionText": "To determine sentiment, an ML approach would be to:",
"answerOptions": [ "answerOptions": [
{ {
"answerText": "a", "answerText": "apply Regression techniques to manually generated opinions and scores and look for patterns",
"isCorrect": "false" "isCorrect": "false"
}, },
{ {
"answerText": "b", "answerText": "apply NLP techniques to manually generated opinions and scores and look for patterns",
"isCorrect": "true" "isCorrect": "true"
}, },
{ {
"answerText": "c", "answerText": "apply Clustering techniques to manually generated opinions and scores and look for patterns",
"isCorrect": "false" "isCorrect": "false"
} }
] ]

Loading…
Cancel
Save