forked from explosion/spacy-course
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Chapter 2 exercises + solutions + tests
- Loading branch information
1 parent
1ac5809
commit b54b602
Showing
41 changed files
with
641 additions
and
644 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
After the Cold War, the UN saw a radical expansion in its peacekeeping duties, taking on more missions in ten years than it had in the previous four decades.Between 1988 and 2000, the number of adopted Security Council resolutions more than doubled, and the peacekeeping budget increased more than tenfold. The UN negotiated an end to the Salvadoran Civil War, launched a successful peacekeeping mission in Namibia, and oversaw democratic elections in post-apartheid South Africa and post-Khmer Rouge Cambodia. In 1991, the UN authorized a US-led coalition that repulsed the Iraqi invasion of Kuwait. Brian Urquhart, Under-Secretary-General from 1971 to 1985, later described the hopes raised by these successes as a "false renaissance" for the organization, given the more troubled missions that followed. Though the UN Charter had been written primarily to prevent aggression by one nation against another, in the early 1990s the UN faced a number of simultaneous, serious crises within nations such as Somalia, Haiti, Mozambique, and the former Yugoslavia. The UN mission in Somalia was widely viewed as a failure after the US withdrawal following casualties in the Battle of Mogadishu, and the UN mission to Bosnia faced "worldwide ridicule" for its indecisive and confused mission in the face of ethnic cleansing. In 1994, the UN Assistance Mission for Rwanda failed to intervene in the Rwandan genocide amid indecision in the Security Council. Beginning in the last decades of the Cold War, American and European critics of the UN condemned the organization for perceived mismanagement and corruption. In 1984, the US President, Ronald Reagan, withdrew his nation's funding from UNESCO (the United Nations Educational, Scientific and Cultural Organization, founded 1946) over allegations of mismanagement, followed by Britain and Singapore. Boutros Boutros-Ghali, Secretary-General from 1992 to 1996, initiated a reform of the Secretariat, reducing the size of the organization somewhat. His successor, Kofi Annan (1997–2006), initiated further management reforms in the face of threats from the United States to withhold its UN dues. In the late 1990s and 2000s, international interventions authorized by the UN took a wider variety of forms. The UN mission in the Sierra Leone Civil War of 1991–2002 was supplemented by British Royal Marines, and the invasion of Afghanistan in 2001 was overseen by NATO. In 2003, the United States invaded Iraq despite failing to pass a UN Security Council resolution for authorization, prompting a new round of questioning of the organization's effectiveness. Under the eighth Secretary-General, Ban Ki-moon, the UN has intervened with peacekeepers in crises including the War in Darfur in Sudan and the Kivu conflict in the Democratic Republic of Congo and sent observers and chemical weapons inspectors to the Syrian Civil War. In 2013, an internal review of UN actions in the final battles of the Sri Lankan Civil War in 2009 concluded that the organization had suffered "systemic failure". One hundred and one UN personnel died in the 2010 Haiti earthquake, the worst loss of life in the organization's history. The Millennium Summit was held in 2000 to discuss the UN's role in the 21st century. The three day meeting was the largest gathering of world leaders in history, and culminated in the adoption by all member states of the Millennium Development Goals (MDGs), a commitment to achieve international development in areas such as poverty reduction, gender equality, and public health. Progress towards these goals, which were to be met by 2015, was ultimately uneven. The 2005 World Summit reaffirmed the UN's focus on promoting development, peacekeeping, human rights, and global security. The Sustainable Development Goals were launched in 2015 to succeed the Millennium Development Goals. In addition to addressing global challenges, the UN has sought to improve its accountability and democratic legitimacy by engaging more with civil society and fostering a global constituency. In an effort to enhance transparency, in 2016 the organization held its first public debate between candidates for Secretary-General. On 1 January 2017, Portuguese diplomat António Guterres, who previously served as UN High Commissioner for Refugees, became the ninth Secretary-General. Guterres has highlighted several key goals for his administration, including an emphasis on diplomacy for preventing conflicts, more effective peacekeeping efforts, and streamlining the organization to be more responsive and versatile to global needs. | ||
Las propuestas de reforma del Consejo empezaron con la conferencia que escribió la Carta de la ONU y han continuado hasta el presente. Como el historiador británico Paul Kennedy escribió "todo el mundo acepta que la presente estructura es defectuosa. Pero el consenso de cómo arreglarla permanece fuera de alcance". Ha habido conversaciones para incrementar el número permanente de miembros. Los países que han hecho demandas más fuertes para los asientos permanentes son Brasil, Alemania, India y Japón. Japón y Alemania, los principales poderes derrotados en la II Guerra Mundial, son ahora los segundos y terceros mayores financiadores de la ONU respectivamente, mientras que Brasil e India son dos de los mayores contribuidores de tropas para las misiones de la paz de la ONU. Esta propuesta ha encontrado oposición en un grupo de países llamado Unidos por Consenso. El anterior secretario de la ONU, Kofi Annan, pidió a un equipo de asesores que realizaran recomendaciones para reformar la ONU para el año 2004. Una medida propuesta es incrementar el número permanente de miembros de cinco, que, en muchas propuestas, podría incluir Brasil, Alemania, India y Japón (conocidas como las naciones del G4), un asiento para África (más habitualmente entre Egipto, Nigeria o Sudáfrica) y/o un asiento de la Liga Árabe. El 21 de septiembre de 2004 las naciones del G4 publicaron una declaración conjunta para respaldar mutuamente el sí a la condición de permanente, junto con dos países africanos. La propuesta tendría que ser aceptada por dos tercios de la Asamblea General (128 votos). Los miembros permanentes, cada uno sosteniendo el derecho de veto, anunciaron sus posiciones sobre la reforma del Consejo de Seguridad de forma reacia. Los Estados Unidos han apoyado inequívocamente la membresía de Japón y han prestado su apoyo a India y a un pequeño número de miembros no permanentes. El Reino Unido y Francia esencialmente apoyan la posición del G4, con la expansión del número de miembros permanente y no permanente y el acceso de Alemania, Brasil, India y Japón al estatus de miembro permanente, así como un incremento en la presencia de países africanos en el Consejo. China ha apoyado el fortalecimiento de la representación de los países en desarrollo y se ha opuesto firmemente a la membresía de Japón. A la puja de India por ser miembro permanente del Consejo de Seguridad han mostrado su apoyo Francia, Rusia, Reino Unido, y Estados Unidos aunque los Estados unidos inicialmente se opusieron a la candidatura india en materia de proliferación nuclear, al haber adquirido India armas nucleares y no haber firmado el Tratado de No Proliferación. El 15 de abril de 2011, China oficialmente expresó su apoyo para un incremento del rol indio en las Naciones unidas, sin especificar ambiciones de endorsar el Consejo de Seguridad. En cualquier caso, recientemente China ha expresado su apoyo para la candidatura de India como un miembro permanente si India revoca su apoyo a la candidatura japonesa. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import spacy | ||
|
||
nlp = spacy.load("en_core_web_sm") | ||
doc = nlp("I have a cat") | ||
nlp = spacy.load("es_core_news_sm") | ||
doc = nlp("Yo tengo un gato") | ||
|
||
# Busca el hash para la palabra "cat" | ||
cat_hash = ____.____.____[____] | ||
print(cat_hash) | ||
# Busca el hash para la palabra "gato" | ||
gato_hash = ____.____.____[____] | ||
print(gato_hash) | ||
|
||
# Busca el cat_hash para obtener el string | ||
cat_string = ____.____.____[____] | ||
print(cat_string) | ||
# Busca el gato_hash para obtener el string | ||
gato_string = ____.____.____[____] | ||
print(gato_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import spacy | ||
|
||
# Carga el modelo en_core_web_md | ||
# Carga el modelo es_core_news_md | ||
nlp = ____ | ||
|
||
# Procesa un texto | ||
doc = nlp("Two bananas in pyjamas") | ||
doc = nlp("Hoy hice pan de banano") | ||
|
||
# Obtén el vector para el token "bananas" | ||
bananas_vector = ____.____ | ||
print(bananas_vector) | ||
# Obtén el vector para el token "banano" | ||
banano_vector = ____.____ | ||
print(banano_vector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import spacy | ||
|
||
nlp = spacy.load("en_core_web_md") | ||
nlp = spacy.load("es_core_news_md") | ||
|
||
doc = nlp("TV and books") | ||
doc = nlp("TV y libros") | ||
token1, token2 = doc[0], doc[2] | ||
|
||
# Obtén la similitud entre los tokens "TV" y "books" | ||
# Obtén la similitud entre los tokens "TV" y "libros" | ||
similarity = ____.____(____) | ||
print(similarity) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import spacy | ||
|
||
nlp = spacy.load("en_core_web_sm") | ||
doc = nlp("I have a cat") | ||
nlp = spacy.load("es_core_news_sm") | ||
doc = nlp("Yo tengo un gato") | ||
|
||
# Busca el hash para la palabra "cat" | ||
cat_hash = nlp.vocab.strings["cat"] | ||
print(cat_hash) | ||
# Busca el hash para la palabra "gato" | ||
gato_hash = nlp.vocab.strings["gato"] | ||
print(gato_hash) | ||
|
||
# Busca el cat_hash para obtener el string | ||
cat_string = nlp.vocab.strings[cat_hash] | ||
print(cat_string) | ||
# Busca el gato_hash para obtener el string | ||
gato_string = nlp.vocab.strings[gato_hash] | ||
print(gato_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import spacy | ||
|
||
nlp = spacy.load("en_core_web_sm") | ||
doc = nlp("Berlin is a nice city") | ||
nlp = spacy.load("es_core_news_sm") | ||
doc = nlp("Por Berlín fluye el río Esprea.") | ||
|
||
# Itera sobre los tokens | ||
for token in doc: | ||
# Revisa si el token actual es un nombre propio | ||
if token.pos_ == "PROPN": | ||
# Revisa si el siguiente token es un verbo | ||
if doc[token.i + 1].pos_ == "VERB": | ||
print("Found proper noun before a verb:", token.text) | ||
print("Encontré un nombre propio antes de un verbo:", token.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import spacy | ||
|
||
# Carga el modelo en_core_web_md | ||
nlp = spacy.load("en_core_web_md") | ||
# Carga el modelo es_core_news_md | ||
nlp = spacy.load("es_core_news_md") | ||
|
||
# Procesa un texto | ||
doc = nlp("Two bananas in pyjamas") | ||
doc = nlp("Hoy hice pan de banano") | ||
|
||
# Obtén el vector para el token "bananas" | ||
bananas_vector = doc[1].vector | ||
print(bananas_vector) | ||
# Obtén el vector para el token "banano" | ||
banano_vector = doc[4].vector | ||
print(banano_vector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import spacy | ||
|
||
nlp = spacy.load("en_core_web_md") | ||
nlp = spacy.load("es_core_news_md") | ||
|
||
doc = nlp("TV and books") | ||
doc = nlp("TV y libros") | ||
token1, token2 = doc[0], doc[2] | ||
|
||
# Obtén la similitud entre los tokens "TV" y "books" | ||
# Obtén la similitud entre los tokens "TV" y "libros" | ||
similarity = token1.similarity(token2) | ||
print(similarity) |
Oops, something went wrong.