Skip to content

Commit

Permalink
NLP 3 quiz
Browse files Browse the repository at this point in the history
  • Loading branch information
jlooper committed Jun 3, 2021
1 parent 50f2b2b commit 58c0751
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
6 changes: 3 additions & 3 deletions NLP/3-Translation-Sentiment/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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.
## [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:

Expand Down Expand Up @@ -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:

"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'.

Expand Down Expand Up @@ -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?

## [Post-lecture quiz](link-to-quiz-app)
## [Pre-lecture quiz](https://jolly-sea-0a877260f.azurestaticapps.net/quiz/34/)

## Review & Self Study

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

0 comments on commit 58c0751

Please sign in to comment.