Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chapters/de/chapter1/10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Doch zuerst wollen wir noch testen, was du in diesem Kapitel gelernt hast!
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -55,7 +55,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
},
{
text: "Er gibt Begriffe zurück, die für Personen, Organisationen oder Orte stehen.",
explain: "Außerdem werden mit <code>grouped_entities=True</code> die Wörter, die zur selben Entität gehören, gruppiert, wie z. B. \"Hugging Face\".",
explain: "Außerdem werden mit <code>aggregation_strategy=&quot;simple&quot;</code> die Wörter, die zur selben Entität gehören, gruppiert, wie z. B. \"Hugging Face\".",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/de/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Bei der Eigennamenerkennung (engl. Named Entity Recognition, NER) handelt es sic
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -216,7 +216,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")

Hier hat das Modell richtig erkannt, dass Sylvain eine Person (PER), Hugging Face eine Organisation (ORG) und Brooklyn ein Ort (LOC) ist.

In der Funktion zur Erstellung der Pipeline übergeben wir die Option `grouped_entities=True`, um die Pipeline anzuweisen, die Teile des Satzes, die der gleichen Entität entsprechen, zu gruppieren: Hier hat das Modell "Hugging" und "Face" richtigerweise als eine einzelne Organisation gruppiert, auch wenn der Name aus mehreren Wörtern besteht. Wie wir im nächsten Kapitel sehen werden, werden bei der Vorverarbeitung (engl. Preprocessing) sogar einige Wörter in kleinere Teile zerlegt. Zum Beispiel wird `Sylvain` in vier Teile zerlegt: `S`, `##yl`, `##va` und `##in`. Im Nachverarbeitungsschritt (engl. Post-Processing) hat die Pipeline diese Teile erfolgreich neu gruppiert.
In der Funktion zur Erstellung der Pipeline übergeben wir die Option `aggregation_strategy="simple"`, um die Pipeline anzuweisen, die Teile des Satzes, die der gleichen Entität entsprechen, zu gruppieren: Hier hat das Modell "Hugging" und "Face" richtigerweise als eine einzelne Organisation gruppiert, auch wenn der Name aus mehreren Wörtern besteht. Wie wir im nächsten Kapitel sehen werden, werden bei der Vorverarbeitung (engl. Preprocessing) sogar einige Wörter in kleinere Teile zerlegt. Zum Beispiel wird `Sylvain` in vier Teile zerlegt: `S`, `##yl`, `##va` und `##in`. Im Nachverarbeitungsschritt (engl. Post-Processing) hat die Pipeline diese Teile erfolgreich neu gruppiert.

> [!TIP]
> ✏️ **Probiere es aus!** Suche im Model Hub nach einem Modell, das in der Lage ist, Part-of-Speech-Tagging (in der Regel als POS abgekürzt) im Englischen durchzuführen (Anm.: d. h. Wortarten zuzuordnen). Was sagt dieses Modell für den Satz im obigen Beispiel vorher?
Expand Down
4 changes: 2 additions & 2 deletions chapters/en/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Named entity recognition (NER) is a task where the model has to find which parts
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -236,7 +236,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")

Here the model correctly identified that Sylvain is a person (PER), Hugging Face an organization (ORG), and Brooklyn a location (LOC).

We pass the option `grouped_entities=True` in the pipeline creation function to tell the pipeline to regroup together the parts of the sentence that correspond to the same entity: here the model correctly grouped "Hugging" and "Face" as a single organization, even though the name consists of multiple words. In fact, as we will see in the next chapter, the preprocessing even splits some words into smaller parts. For instance, `Sylvain` is split into four pieces: `S`, `##yl`, `##va`, and `##in`. In the post-processing step, the pipeline successfully regrouped those pieces.
We pass the option `aggregation_strategy="simple"` in the pipeline creation function to tell the pipeline to regroup together the parts of the sentence that correspond to the same entity: here the model correctly grouped "Hugging" and "Face" as a single organization, even though the name consists of multiple words. In fact, as we will see in the next chapter, the preprocessing even splits some words into smaller parts. For instance, `Sylvain` is split into four pieces: `S`, `##yl`, `##va`, and `##in`. In the post-processing step, the pipeline successfully regrouped those pieces.

> [!TIP]
> ✏️ **Try it out!** Search the Model Hub for a model able to do part-of-speech tagging (usually abbreviated as POS) in English. What does this model predict for the sentence in the example above?
Expand Down
4 changes: 2 additions & 2 deletions chapters/en/chapter1/7.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This quiz is ungraded, so you can try it as many times as you want. If you strug
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -53,7 +53,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
},
{
text: "It will return the words representing persons, organizations or locations.",
explain: "Furthermore, with <code>grouped_entities=True</code>, it will group together the words belonging to the same entity, like \"Hugging Face\".",
explain: "Furthermore, with <code>aggregation_strategy=&quot;simple&quot;</code>, it will group together the words belonging to the same entity, like \"Hugging Face\".",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/es/chapter1/10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Por ahora, ¡revisemos lo que aprendiste en este capítulo!
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -52,7 +52,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
},
{
text: "Devuelve las palabras que representan personas, organizaciones o ubicaciones.",
explain: "Adicionalmente, con <code>grouped_entities=True</code>, agrupará las palabras que pertenecen a la misma entidad, como \"Hugging Face\".",
explain: "Adicionalmente, con <code>aggregation_strategy=&quot;simple&quot;</code>, agrupará las palabras que pertenecen a la misma entidad, como \"Hugging Face\".",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/es/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ El reconocimiento de entidades nombradas (REN) es una tarea en la que el modelo
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -216,7 +216,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")

En este caso el modelo identificó correctamente que Sylvain es una persona (PER), Hugging Face una organización (ORG) y Brooklyn una ubicación (LOC).

Pasamos la opción `grouped_entities=True` en la función de creación del pipeline para decirle que agrupe las partes de la oración que corresponden a la misma entidad: Aquí el modelo agrupó correctamente "Hugging" y "Face" como una sola organización, a pesar de que su nombre está compuesto de varias palabras. De hecho, como veremos en el siguiente capítulo, el preprocesamiento puede incluso dividir palabras en partes más pequeñas. Por ejemplo, 'Sylvain' se separa en cuatro piezas: `S`, `##yl`, `##va` y`##in`. En el paso de prosprocesamiento, el pipeline reagrupa de manera exitosa dichas piezas.
Pasamos la opción `aggregation_strategy="simple"` en la función de creación del pipeline para decirle que agrupe las partes de la oración que corresponden a la misma entidad: Aquí el modelo agrupó correctamente "Hugging" y "Face" como una sola organización, a pesar de que su nombre está compuesto de varias palabras. De hecho, como veremos en el siguiente capítulo, el preprocesamiento puede incluso dividir palabras en partes más pequeñas. Por ejemplo, 'Sylvain' se separa en cuatro piezas: `S`, `##yl`, `##va` y`##in`. En el paso de prosprocesamiento, el pipeline reagrupa de manera exitosa dichas piezas.

> [!TIP]
> ✏️ **¡Pruébalo!** Busca en el Model Hub un modelo capaz de hacer etiquetado *part-of-speech* (que se abrevia usualmente como POS) en Inglés. ¿Qué predice este modelo para la oración en el ejemplo de arriba?
Expand Down
4 changes: 2 additions & 2 deletions chapters/fr/chapter1/10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Mais avant d'aller plus loin, prenons un instant pour voir ce que vous avez appr
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner(
"My name is Sylvain and I work at Hugging Face in Brooklyn."
) # Je m'appelle Sylvain et je travaille à Hugging Face à Brooklyn.
Expand All @@ -56,7 +56,7 @@ ner(
},
{
text: "Il renvoie les entités nommées dans cette phrase, telles que les personnes, les organisations ou lieux.",
explain: "De plus, avec <code>grouped_entities=True</code>, cela regroupe les mots appartenant à la même entité, comme par exemple \"Hugging Face\".",
explain: "De plus, avec <code>aggregation_strategy=&quot;simple&quot;</code>, cela regroupe les mots appartenant à la même entité, comme par exemple \"Hugging Face\".",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/fr/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ La reconnaissance d'entités nommées ou NER (pour *Named Entity Recognition*) e
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner(
"My name is Sylvain and I work at Hugging Face in Brooklyn."
) # Je m'appelle Sylvain et je travaille à Hugging Face à Brooklyn.
Expand All @@ -242,7 +242,7 @@ ner(

Nous pouvons voir que le modèle a correctement identifié Sylvain comme une personne (PER), Hugging Face comme une organisation (ORG) et Brooklyn comme un lieu (LOC).

Il est possible d'utiliser l'option `grouped_entities=True` lors de la création du pipeline pour regrouper les parties du texte qui correspondent à la même entité : ici le modèle à correctement regroupé `Hugging` et `Face` comme une seule organisation, même si le nom comporte plusieurs mots. En effet, comme nous allons voir dans le prochain chapitre, la prétraitement du texte sépare parfois certains mots en plus petites parties. Par exemple, `Sylvain` est séparé en quatre morceaux : `S`, `##yl`, `##va`, et `##in`. Dans l'étape de post-traitement, le pipeline a réussi à regrouper ces morceaux.
Il est possible d'utiliser l'option `aggregation_strategy="simple"` lors de la création du pipeline pour regrouper les parties du texte qui correspondent à la même entité : ici le modèle à correctement regroupé `Hugging` et `Face` comme une seule organisation, même si le nom comporte plusieurs mots. En effet, comme nous allons voir dans le prochain chapitre, la prétraitement du texte sépare parfois certains mots en plus petites parties. Par exemple, `Sylvain` est séparé en quatre morceaux : `S`, `##yl`, `##va`, et `##in`. Dans l'étape de post-traitement, le pipeline a réussi à regrouper ces morceaux.

> [!TIP]
> ✏️ **Essayez !** Recherchez sur le *Hub* un modèle capable de reconnaître les différentes parties du langage (généralement abrégé en POS pour *Part-of-speech*) en anglais. Que prédit le modèle pour la phrase dans notre exemple du pipeline au-dessus ?
Expand Down
4 changes: 2 additions & 2 deletions chapters/hi/chapter1/10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -50,7 +50,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
},
{
text: "यह व्यक्तियों, संगठनों या स्थानों का प्रतिनिधित्व करने वाले शब्दों को वापस कर देगा।",
explain: "इसके अलावा, <code>grouped_entities=True</code> के साथ, यह एक ही इकाई से संबंधित शब्दों को एक साथ समूहित करेगा, जैसे \"हगिंग फेस\"।",
explain: "इसके अलावा, <code>aggregation_strategy=&quot;simple&quot;</code> के साथ, यह एक ही इकाई से संबंधित शब्दों को एक साथ समूहित करेगा, जैसे \"हगिंग फेस\"।",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/hi/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ unmasker("This course will teach you all about <mask> models.", top_k=2)
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -230,7 +230,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")

यहां मॉडल ने सही ढंग से पहचाना कि सिल्वेन एक व्यक्ति (पीईआर), हगिंग फेस एक संगठन (ओआरजी), और ब्रुकलिन एक स्थान (एलओसी) है।

हम पाइपलाइन निर्माण फ़ंक्शन में विकल्प `grouped_entities=True` पास करते हैं ताकि पाइपलाइन को एक ही इकाई के अनुरूप वाक्य के हिस्सों को एक साथ फिर से समूहित करने के लिए कहा जा सके: यहां मॉडल ने एक ही संगठन के रूप में "हगिंग" और "फेस" को सही ढंग से समूहीकृत किया है, भले ही नाम में कई शब्द हों। वास्तव में, जैसा कि हम अगले अध्याय में देखेंगे, प्रीप्रोसेसिंग कुछ शब्दों को छोटे भागों में भी विभाजित करता है। उदाहरण के लिए, `सिल्वेन` को चार भागों में बांटा गया है: `S`, `##yl`, `##va`, और `##in`। प्रसंस्करण के बाद के चरण में, पाइपलाइन ने उन टुकड़ों को सफलतापूर्वक पुन: समूहित किया।
हम पाइपलाइन निर्माण फ़ंक्शन में विकल्प `aggregation_strategy="simple"` पास करते हैं ताकि पाइपलाइन को एक ही इकाई के अनुरूप वाक्य के हिस्सों को एक साथ फिर से समूहित करने के लिए कहा जा सके: यहां मॉडल ने एक ही संगठन के रूप में "हगिंग" और "फेस" को सही ढंग से समूहीकृत किया है, भले ही नाम में कई शब्द हों। वास्तव में, जैसा कि हम अगले अध्याय में देखेंगे, प्रीप्रोसेसिंग कुछ शब्दों को छोटे भागों में भी विभाजित करता है। उदाहरण के लिए, `सिल्वेन` को चार भागों में बांटा गया है: `S`, `##yl`, `##va`, और `##in`। प्रसंस्करण के बाद के चरण में, पाइपलाइन ने उन टुकड़ों को सफलतापूर्वक पुन: समूहित किया।

> [!TIP]
> ✏️ **कोशिश करके देखो!** अंग्रेजी में पार्ट-ऑफ-स्पीच टैगिंग (आमतौर पर पीओएस के रूप में संक्षिप्त) करने में सक्षम मॉडल के लिए मॉडल हब खोजें। यह मॉडल उपरोक्त उदाहरण में वाक्य के लिए क्या भविष्यवाणी करता है?
Expand Down
4 changes: 2 additions & 2 deletions chapters/it/chapter1/10.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Prima di procedere, però, verifichiamo cos'hai imparato in questo capitolo!
```py
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -55,7 +55,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
},
{
text: "Restituisce i termini che rappresentano persone, organizzazioni o luoghi.",
explain: "Inoltre, grazie a <code>grouped_entities=True</code>, la pipeline è in grado di raggruppare le parole che appartengono alla stessa entità, come \"Hugging Face\".",
explain: "Inoltre, grazie a <code>aggregation_strategy=&quot;simple&quot;</code>, la pipeline è in grado di raggruppare le parole che appartengono alla stessa entità, come \"Hugging Face\".",
correct: true
}
]}
Expand Down
4 changes: 2 additions & 2 deletions chapters/it/chapter1/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Il riconoscimento delle entità nominate (*Named entity recognition*, NER) è un
```python
from transformers import pipeline

ner = pipeline("ner", grouped_entities=True)
ner = pipeline("ner", aggregation_strategy="simple")
ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")
```

Expand All @@ -216,7 +216,7 @@ ner("My name is Sylvain and I work at Hugging Face in Brooklyn.")

Qui il modello ha correttamente identificato che Sylvain è una persona (PER), Hugging Face un'organizzazione (ORG), e Brooklyn una località (LOC).

Passiamo l'opzione `grouped_entities=True` nella funzione di creazione della pipeline per raggruppare le parti frasali che corrispondono alla stessa entità: qui il modello raggruppa correttamente "Hugging" e "Face" come singola organizzazione, nonostante il nome sia formato da più parole. A dire il vero, come vedremo nel prossimo capitolo, il preprocessing divide perfino alcune parole in parti più piccole. Ad esempio, `Sylvain` viene suddiviso in quattro parti: `S`, `##yl`, `##va`, and `##in`. Al momento del post-processing, la pipeline raggruppa le parti con successo.
Passiamo l'opzione `aggregation_strategy="simple"` nella funzione di creazione della pipeline per raggruppare le parti frasali che corrispondono alla stessa entità: qui il modello raggruppa correttamente "Hugging" e "Face" come singola organizzazione, nonostante il nome sia formato da più parole. A dire il vero, come vedremo nel prossimo capitolo, il preprocessing divide perfino alcune parole in parti più piccole. Ad esempio, `Sylvain` viene suddiviso in quattro parti: `S`, `##yl`, `##va`, and `##in`. Al momento del post-processing, la pipeline raggruppa le parti con successo.

> [!TIP]
> ✏️ **Provaci anche tu!** Nel Model Hub, cerca un modello capace di effettuare part-of-speech tagging (comunemente abbreviato come POS) in inglese. Cosa predice il modello per la frase nell'esempio qui sopra?
Expand Down
Loading