Practice: tagging watch with probabilitiesExercices : étiqueter montre avec des probabilités
TRA2600 S5 · in classS5 · en classe
The corpus
The exercises below apply the four steps of the worked example to another word, watch, which can be a noun (an old watch) or a verb (the children watch the birds) (see also the Tagging with probabilities from an annotated corpus page) (voir aussi la page Étiqueter avec des probabilités tirées d'un corpus annoté). Most of them are about the sentence She/PRON checks/VERB her/PRON watch/?. The counts come from the small tagged corpus below, in which each word is followed by its tag from the Universal Dependencies tagset tagsetjeu d'étiquettes NLPTAL The set of labels available to a part-of-speech tagger or to an annotation task, from which exactly one is given to each word.Ensemble des étiquettes dont dispose un étiqueteur morphosyntaxique ou une tâche d'annotation, et dont exactement une est attribuée à chaque mot. : NOUN for a noun, VERB for a verb, DET for a determiner, PRON for a pronoun, PUNCT for punctuation, and so on. Universal Dependencies tags possessives such as her and his as pronouns. The corpus has been tokenized the way a tagger’s training data usually is, so can’t appears as ca n’t.
Lea/PROPN wears/VERB an/DET old/ADJ watch/NOUN on/ADP her/PRON wrist/NOUN ./PUNCT
Her/PRON grandfather/NOUN shows/VERB her/PRON how/ADV to/PART wind/VERB it/PRON ./PUNCT
Every/DET morning/NOUN ,/PUNCT the/DET children/NOUN watch/VERB the/DET birds/NOUN in/ADP their/PRON garden/NOUN ./PUNCT
A/DET guide/NOUN takes/VERB visitors/NOUN to/ADP a/DET workshop/NOUN where/ADV craftsmen/NOUN repair/VERB clocks/NOUN for/ADP them/PRON ./PUNCT
He/PRON explains/VERB ,/PUNCT pointing/VERB at/ADP the/DET parts/NOUN ,/PUNCT that/SCONJ a/DET watch/NOUN needs/VERB patience/NOUN ./PUNCT
Visitors/NOUN watch/VERB as/SCONJ his/PRON apprentices/NOUN work/VERB in/ADP silence/NOUN ./PUNCT
On/ADP the/DET last/ADJ day/NOUN ,/PUNCT Lea/PROPN and/CCONJ Tom/PROPN watch/VERB a/DET demonstration/NOUN ./PUNCT
They/PRON ca/AUX n't/PART believe/VERB how/ADV small/ADJ the/DET parts/NOUN are/AUX ./PUNCT To answer, count in the corpus: all the nouns and all the verbs, those that are the form watch, and what follows each pronoun and each punctuation mark. Each line is one sentence, and you count what follows a word inside its sentence: the final full stop is followed by nothing. The probabilities are shares, so write them as decimals or as percentages, rounded to two decimals.
Exercises
The tagger's first question: how typical watch is of nouns. Count all the words tagged NOUN in the corpus, then those that are the form watch. What is P(watch | NOUN)? Round to two decimals.
Première question de l'étiqueteur : à quel point « montre » est typique des noms. Comptez tous les mots étiquetés NOUN dans le corpus, puis ceux qui sont la forme « montre ». Quelle est P(montre | NOUN) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 21 nouns, of which 2 are watch (an old watch, a watch needs). P(watch | NOUN) = 2 / 21 = 0.10, or 9.52 %.
Le corpus compte 21 noms, dont 2 sont « montre » (« une montre en or », « qu'une montre demande »). P(montre | NOUN) = 2 / 21 = 0,10, soit 9,52 %.
The same calculation for verbs: what is P(watch | VERB)? Count all the verbs, then those that are the form watch. Round to two decimals.
Le même calcul pour les verbes : quelle est P(montre | VERB) ? Comptez tous les verbes, puis ceux qui sont la forme « montre ». Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 13 verbs, of which 3 are watch (the children watch, Visitors watch, Lea and Tom watch). P(watch | VERB) = 3 / 13 = 0.23, or 23.08 %. On the word alone, VERB is ahead: watch is a verb more often than a noun in the corpus.
Le corpus compte 12 verbes, dont 3 sont « montre » (« lui montre », « un guide montre », « Léa montre »). P(montre | VERB) = 3 / 12 = 0,25. « Montrant » est un verbe mais une autre forme : il compte parmi les 12 verbes, pas parmi les « montre ». Sur le mot seul, VERB est en tête : « montre » est plus souvent un verbe qu'un nom dans le corpus.
The second question: what usually follows the previous tag. In she checks her watch, the word before watch is her, which Universal Dependencies tags as a pronoun (PRON), possessive or not. Count all the words that follow a pronoun in the corpus, then those that are nouns. What is P(NOUN | PRON)? Round to two decimals.
Seconde question : ce qui suit d'habitude l'étiquette précédente. Dans « un bracelet de montre », le mot avant « montre » est « de », une préposition (ADP). Comptez tous les mots qui suivent une préposition dans le corpus, puis ceux qui sont des noms. Quelle est P(NOUN | ADP) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 9 pronouns, and 4 are followed by a noun: her wrist, Her grandfather, their garden and his apprentices. P(NOUN | PRON) = 4 / 9 = 0.44, or 44.44 %. Of the other five, two are followed by punctuation, one by an adverb, one by an auxiliary and one by a verb.
Le corpus compte 10 prépositions, et 4 sont suivies d'un nom : « en or », « avec attention », « d'horlogerie » et « en silence ». P(NOUN | ADP) = 4 / 10 = 0,40. Cinq autres sont suivies d'un déterminant, comme « à le poignet », et la dernière d'un verbe.
The same calculation for verbs: what is P(VERB | PRON)? Round to two decimals.
Le même calcul pour les verbes : quelle est P(VERB | ADP) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
Only one of the 9 pronouns is followed by a verb: He explains. P(VERB | PRON) = 1 / 9 = 0.11, or 11.11 %. This count covers every verb, whatever its form: here the tagger only looks at the tags.
Une seule des 10 prépositions est suivie d'un verbe : « à croire ». P(VERB | ADP) = 1 / 10 = 0,10. Ce compte porte sur tous les verbes, quelle que soit leur forme : l'étiqueteur ne regarde ici que les étiquettes.
Which tag does the bigram tagger give watch in She checks her watch, and why?
Quelle étiquette l'étiqueteur bigramme donne-t-il à « montre » dans « Elle cherche un bracelet de montre », et pourquoi ?
Show the solutionVoir la solution
The tagger compares two products: for the noun, 0.0952 × 0.444 = 0.042; for the verb, 0.231 × 0.111 = 0.026. The noun wins.
The first answer is the most frequent tag: on the word alone, VERB was ahead, and the tag would be wrong. The previous tag overturns the verb's lead, as in the worked example but the other way round. The third answer gives the right tag for the wrong reason: the tagger only knows that the previous tag is PRON, and nothing about possessives. The fourth forgets that the tagger never looks for the sentence in the corpus: it combines two counts, and both are there.
L'étiqueteur compare deux produits : pour le nom, 0,0952 × 0,40 = 0,038 ; pour le verbe, 0,25 × 0,10 = 0,025. Le nom l'emporte.
La première réponse est l'étiquette la plus fréquente : sur le mot seul, VERB était en tête, et l'étiquette serait fausse. C'est l'étiquette précédente qui renverse l'avance du verbe, comme dans l'exemple détaillé, mais dans l'autre sens. La troisième réponse donne la bonne étiquette pour une mauvaise raison : l'étiqueteur bigramme regarde l'étiquette du mot précédent, ADP pour « de », et non le mot « bracelet ». La quatrième oublie que l'étiqueteur ne cherche jamais la phrase dans le corpus : il combine deux comptes, et tous deux s'y trouvent.
Which tag does the bigram tagger give watch in He waits, watch in hand, and is the tag right?
Quelle étiquette l'étiqueteur bigramme donne-t-il à « montre » dans « Il attend, montre en main », et cette étiquette est-elle juste ?
Show the solutionVoir la solution
The previous word is the comma, tagged PUNCT. In the corpus, four words follow punctuation inside a sentence: one is a verb (, pointing) and none is a noun. The product for NOUN is therefore 0, and the product for VERB is small but positive: 0.231 × 1 / 4 = 0.058. VERB wins, and the tag is wrong: in watch in hand, watch is a noun.
The method works exactly as it should: the corpus has no noun after punctuation, so a zero decides the case. Real taggers give every count a small minimum for this reason. The first answer credits the tagger with a look at the next word, which is not part of its two counts, and the second describes the most frequent tag, which the bigram tagger does not use on its own.
Le mot précédent est la virgule, étiquetée PUNCT. Dans le corpus, six mots suivent une ponctuation à l'intérieur d'une phrase : un seul est un verbe (« , montrant ») et aucun n'est un nom. Le produit pour NOUN vaut donc 0, et celui pour VERB est petit mais positif : 0,25 × 1 / 6 = 0,042. VERB l'emporte, et l'étiquette est fausse : dans « montre en main », « montre » est un nom.
La méthode fonctionne exactement comme prévu : le corpus ne contient aucun nom après une ponctuation, si bien qu'un zéro tranche le cas. C'est pour cette raison que les vrais étiqueteurs donnent à chaque compte un petit minimum. La première réponse prête à l'étiqueteur un regard sur le mot suivant, qui ne fait pas partie de ses deux comptes, et la deuxième décrit l'étiquette la plus fréquente, que l'étiqueteur bigramme n'utilise pas seule.
Le corpus
Les exercices ci-dessous appliquent les quatre étapes de l’exemple détaillé à un autre mot, montre, qui peut être un nom (une montre en or) ou un verbe (il lui montre le chemin) (see also the Tagging with probabilities from an annotated corpus page) (voir aussi la page Étiqueter avec des probabilités tirées d'un corpus annoté). La plupart portent sur la phrase Elle/PRON cherche/VERB un/DET bracelet/NOUN de/ADP montre/?. Les comptes viennent du petit corpus étiqueté ci-dessous, où chaque mot est suivi de son étiquette dans le jeu d’étiquettes tagsetjeu d'étiquettes NLPTAL The set of labels available to a part-of-speech tagger or to an annotation task, from which exactly one is given to each word.Ensemble des étiquettes dont dispose un étiqueteur morphosyntaxique ou une tâche d'annotation, et dont exactement une est attribuée à chaque mot. d’Universal Dependencies : NOUN pour un nom, VERB pour un verbe, DET pour un déterminant, ADP pour une préposition, PUNCT pour une ponctuation, et ainsi de suite. Le corpus a été normalisé comme le sont d’habitude les données d’entraînement d’un étiqueteur, si bien que au y apparaît sous la forme à le et c’est sous la forme ce est.
Léa/PROPN porte/VERB une/DET montre/NOUN en/ADP or/NOUN à/ADP le/DET poignet/NOUN ./PUNCT
Son/DET grand-père/NOUN lui/PRON montre/VERB comment/ADV la/PRON remonter/VERB ./PUNCT
Chaque/DET matin/NOUN ,/PUNCT les/DET enfants/NOUN observent/VERB les/DET oiseaux/NOUN avec/ADP attention/NOUN ./PUNCT
Un/DET guide/NOUN montre/VERB à/ADP les/DET visiteurs/NOUN un/DET atelier/NOUN d'/ADP horlogerie/NOUN ./PUNCT
Il/PRON explique/VERB ,/PUNCT montrant/VERB les/DET pièces/NOUN ,/PUNCT qu'/SCONJ une/DET montre/NOUN demande/VERB de/ADP la/DET patience/NOUN ./PUNCT
Les/DET apprentis/NOUN travaillent/VERB en/ADP silence/NOUN ,/PUNCT sous/ADP le/DET regard/NOUN de/ADP les/DET visiteurs/NOUN ./PUNCT
Le/DET dernier/ADJ jour/NOUN ,/PUNCT Léa/PROPN montre/VERB fièrement/ADV son/DET travail/NOUN ./PUNCT
Elle/PRON trouve/VERB cela/PRON difficile/ADJ à/ADP croire/VERB ,/PUNCT mais/CCONJ ce/PRON est/AUX vrai/ADJ ./PUNCT Pour répondre, comptez dans le corpus : tous les noms et tous les verbes, ceux qui sont la forme montre, et ce qui suit chaque préposition et chaque ponctuation. Chaque ligne est une phrase, et on compte ce qui suit un mot à l’intérieur de sa phrase : le point final n’est suivi de rien. Les probabilités sont des proportions : écrivez-les en décimales ou en pourcentages, arrondies à deux décimales.
Exercices
The tagger's first question: how typical watch is of nouns. Count all the words tagged NOUN in the corpus, then those that are the form watch. What is P(watch | NOUN)? Round to two decimals.
Première question de l'étiqueteur : à quel point « montre » est typique des noms. Comptez tous les mots étiquetés NOUN dans le corpus, puis ceux qui sont la forme « montre ». Quelle est P(montre | NOUN) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 21 nouns, of which 2 are watch (an old watch, a watch needs). P(watch | NOUN) = 2 / 21 = 0.10, or 9.52 %.
Le corpus compte 21 noms, dont 2 sont « montre » (« une montre en or », « qu'une montre demande »). P(montre | NOUN) = 2 / 21 = 0,10, soit 9,52 %.
The same calculation for verbs: what is P(watch | VERB)? Count all the verbs, then those that are the form watch. Round to two decimals.
Le même calcul pour les verbes : quelle est P(montre | VERB) ? Comptez tous les verbes, puis ceux qui sont la forme « montre ». Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 13 verbs, of which 3 are watch (the children watch, Visitors watch, Lea and Tom watch). P(watch | VERB) = 3 / 13 = 0.23, or 23.08 %. On the word alone, VERB is ahead: watch is a verb more often than a noun in the corpus.
Le corpus compte 12 verbes, dont 3 sont « montre » (« lui montre », « un guide montre », « Léa montre »). P(montre | VERB) = 3 / 12 = 0,25. « Montrant » est un verbe mais une autre forme : il compte parmi les 12 verbes, pas parmi les « montre ». Sur le mot seul, VERB est en tête : « montre » est plus souvent un verbe qu'un nom dans le corpus.
The second question: what usually follows the previous tag. In she checks her watch, the word before watch is her, which Universal Dependencies tags as a pronoun (PRON), possessive or not. Count all the words that follow a pronoun in the corpus, then those that are nouns. What is P(NOUN | PRON)? Round to two decimals.
Seconde question : ce qui suit d'habitude l'étiquette précédente. Dans « un bracelet de montre », le mot avant « montre » est « de », une préposition (ADP). Comptez tous les mots qui suivent une préposition dans le corpus, puis ceux qui sont des noms. Quelle est P(NOUN | ADP) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
The corpus has 9 pronouns, and 4 are followed by a noun: her wrist, Her grandfather, their garden and his apprentices. P(NOUN | PRON) = 4 / 9 = 0.44, or 44.44 %. Of the other five, two are followed by punctuation, one by an adverb, one by an auxiliary and one by a verb.
Le corpus compte 10 prépositions, et 4 sont suivies d'un nom : « en or », « avec attention », « d'horlogerie » et « en silence ». P(NOUN | ADP) = 4 / 10 = 0,40. Cinq autres sont suivies d'un déterminant, comme « à le poignet », et la dernière d'un verbe.
The same calculation for verbs: what is P(VERB | PRON)? Round to two decimals.
Le même calcul pour les verbes : quelle est P(VERB | ADP) ? Arrondissez à deux décimales.
Show the explanationVoir l'explication
Only one of the 9 pronouns is followed by a verb: He explains. P(VERB | PRON) = 1 / 9 = 0.11, or 11.11 %. This count covers every verb, whatever its form: here the tagger only looks at the tags.
Une seule des 10 prépositions est suivie d'un verbe : « à croire ». P(VERB | ADP) = 1 / 10 = 0,10. Ce compte porte sur tous les verbes, quelle que soit leur forme : l'étiqueteur ne regarde ici que les étiquettes.
Which tag does the bigram tagger give watch in She checks her watch, and why?
Quelle étiquette l'étiqueteur bigramme donne-t-il à « montre » dans « Elle cherche un bracelet de montre », et pourquoi ?
Show the solutionVoir la solution
The tagger compares two products: for the noun, 0.0952 × 0.444 = 0.042; for the verb, 0.231 × 0.111 = 0.026. The noun wins.
The first answer is the most frequent tag: on the word alone, VERB was ahead, and the tag would be wrong. The previous tag overturns the verb's lead, as in the worked example but the other way round. The third answer gives the right tag for the wrong reason: the tagger only knows that the previous tag is PRON, and nothing about possessives. The fourth forgets that the tagger never looks for the sentence in the corpus: it combines two counts, and both are there.
L'étiqueteur compare deux produits : pour le nom, 0,0952 × 0,40 = 0,038 ; pour le verbe, 0,25 × 0,10 = 0,025. Le nom l'emporte.
La première réponse est l'étiquette la plus fréquente : sur le mot seul, VERB était en tête, et l'étiquette serait fausse. C'est l'étiquette précédente qui renverse l'avance du verbe, comme dans l'exemple détaillé, mais dans l'autre sens. La troisième réponse donne la bonne étiquette pour une mauvaise raison : l'étiqueteur bigramme regarde l'étiquette du mot précédent, ADP pour « de », et non le mot « bracelet ». La quatrième oublie que l'étiqueteur ne cherche jamais la phrase dans le corpus : il combine deux comptes, et tous deux s'y trouvent.
Which tag does the bigram tagger give watch in He waits, watch in hand, and is the tag right?
Quelle étiquette l'étiqueteur bigramme donne-t-il à « montre » dans « Il attend, montre en main », et cette étiquette est-elle juste ?
Show the solutionVoir la solution
The previous word is the comma, tagged PUNCT. In the corpus, four words follow punctuation inside a sentence: one is a verb (, pointing) and none is a noun. The product for NOUN is therefore 0, and the product for VERB is small but positive: 0.231 × 1 / 4 = 0.058. VERB wins, and the tag is wrong: in watch in hand, watch is a noun.
The method works exactly as it should: the corpus has no noun after punctuation, so a zero decides the case. Real taggers give every count a small minimum for this reason. The first answer credits the tagger with a look at the next word, which is not part of its two counts, and the second describes the most frequent tag, which the bigram tagger does not use on its own.
Le mot précédent est la virgule, étiquetée PUNCT. Dans le corpus, six mots suivent une ponctuation à l'intérieur d'une phrase : un seul est un verbe (« , montrant ») et aucun n'est un nom. Le produit pour NOUN vaut donc 0, et celui pour VERB est petit mais positif : 0,25 × 1 / 6 = 0,042. VERB l'emporte, et l'étiquette est fausse : dans « montre en main », « montre » est un nom.
La méthode fonctionne exactement comme prévu : le corpus ne contient aucun nom après une ponctuation, si bien qu'un zéro tranche le cas. C'est pour cette raison que les vrais étiqueteurs donnent à chaque compte un petit minimum. La première réponse prête à l'étiqueteur un regard sur le mot suivant, qui ne fait pas partie de ses deux comptes, et la deuxième décrit l'étiquette la plus fréquente, que l'étiqueteur bigramme n'utilise pas seule.