Skip to content

Commit

Permalink
Adjust Spanish exercises, solutions and tests for chapter 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Romero committed Nov 26, 2021
1 parent e2be714 commit a0a768a
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions exercises/es/exc_02_06.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from spacy.lang.es import Spanish
import spacy

nlp = Spanish()
nlp = spacy.blank("es")

# Importa las clases Doc y Span
from spacy.____ import ____, ____
Expand Down
4 changes: 2 additions & 2 deletions exercises/es/exc_02_13.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

# Inicializa el Matcher y añade los patrones
matcher = Matcher(nlp.vocab)
matcher.add("PATTERN1", None, pattern1)
matcher.add("PATTERN2", None, pattern2)
matcher.add("PATTERN1", [pattern1])
matcher.add("PATTERN2", [pattern2])

# Itera sobre los resultados
for match_id, start, end in matcher(doc):
Expand Down
4 changes: 2 additions & 2 deletions exercises/es/exc_02_14.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
from spacy.lang.es import Spanish
import spacy

with open("exercises/es/countries.json", encoding="utf8") as f:
COUNTRIES = json.loads(f.read())

nlp = Spanish()
nlp = spacy.blank("es")
doc = nlp(
"La Unión Europea fue fundada por seis países de Europa occidental "
"(Francia, Alemania, Italia, Bélgica, Países Bajos, y Luxemburgo) y "
Expand Down
2 changes: 1 addition & 1 deletion exercises/es/exc_02_15.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Itera sobre los resultados
for match_id, start, end in matcher(doc):
# Crea un Span con el label para "LOC"
# Crea un Span con la etiqueta para "LOC"
span = ____(____, ____, ____, label=____)

# Sobrescribe el doc.ents y añade el span
Expand Down
4 changes: 2 additions & 2 deletions exercises/es/solution_02_06.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from spacy.lang.es import Spanish
import spacy

nlp = Spanish()
nlp = spacy.blank("es")

# Importa las clases Doc y Span
from spacy.tokens import Doc, Span
Expand Down
4 changes: 2 additions & 2 deletions exercises/es/solution_02_13.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

# Inicializa el Matcher y añade los patrones
matcher = Matcher(nlp.vocab)
matcher.add("PATTERN1", None, pattern1)
matcher.add("PATTERN2", None, pattern2)
matcher.add("PATTERN1", [pattern1])
matcher.add("PATTERN2", [pattern2])

# Itera sobre los resultados
for match_id, start, end in matcher(doc):
Expand Down
4 changes: 2 additions & 2 deletions exercises/es/solution_02_14.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
from spacy.lang.es import Spanish
import spacy

with open("exercises/es/countries.json", encoding="utf8") as f:
COUNTRIES = json.loads(f.read())

nlp = Spanish()
nlp = spacy.blank("es")
doc = nlp(
"La Unión Europea fue fundada por seis países de Europa occidental "
"(Francia, Alemania, Italia, Bélgica, Países Bajos, y Luxemburgo) y "
Expand Down
2 changes: 1 addition & 1 deletion exercises/es/solution_02_15.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Itera sobre los resultados
for match_id, start, end in matcher(doc):
# Crea un Span con el label para "LOC"
# Crea un Span con la etiqueta para "LOC"
span = Span(doc, start, end, label="LOC")

# Sobrescribe el doc.ents y añade el span
Expand Down
2 changes: 1 addition & 1 deletion exercises/es/test_02_09.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ def test():
__msg__.good(
"¡Bien hecho! En el próximo ejercicio usarás spaCy para predecir "
"similitudes entre documentos, spans y tokens a través de los word vectors "
"usados detrás de cámaras."
"usados detrás de las cámaras."
)

0 comments on commit a0a768a

Please sign in to comment.