Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How I can get the value of this json key called 'sentence'

I want to extract the values of the key called ‘sentence’ of this json:

{"title": "llamar | Definici\u00f3n | Diccionario de la lengua espa\u00f1ola | RAE - ASALE", "articles": [{"id": "NTReP1j", "lema": {"lema": "llamar", "index": 0, "female_suffix": ""}, "supplementary_info": [{"text": "Del lat. (lat\u00edn) clam\u0101re."}], "is": {"verb": true}, "definitions": [{"index": 1, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Intentar captar la atenci\u00f3n de alguien mediante voces, ruidos o gestos."}, "examples": []}, {"index": 2, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [{"abbr": "U. t. c. intr.", "text": "Usado tambi\u00e9n como intransitivo"}], "sentence": {"text": "Realizar las operaciones necesarias para establecer comunicaci\u00f3n telef\u00f3nica con alguien."}, "examples": [{"text": "La llam\u00e9, pero no estaba en casa."}, {"text": "Llama a su oficina."}]}, {"index": 3, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Invocar, pedir auxilio a alguien."}, "examples": []}, {"index": 4, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [{"abbr": "U. t. c. intr.", "text": "Usado tambi\u00e9n como intransitivo"}], "sentence": {"text": "Pedir a alguien que vaya a un lugar."}, "examples": [{"text": "Llamar al m\u00e9dico, a los refuerzos."}, {"text": "Llamar a reuni\u00f3n."}]}, {"index": 5, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Despertar a alguien."}, "examples": []}, {"index": 6, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [{"abbr": "U. t. c. intr.", "text": "Usado tambi\u00e9n como intransitivo"}], "sentence": {"text": "Incitar a alguien a que se comporte de una determinada manera."}, "examples": [{"text": "Llamar a la desobediencia civil."}]}, {"index": 7, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Dar a alguien o algo como denominaci\u00f3n o calificativo la palabra o enunciado que se expresa."}, "examples": [{"text": "Ac\u00e1 llamamos celular a lo que all\u00e1 llaman m\u00f3vil."}, {"text": "Ahora llaman do\u00f1a Ana a Anita."}, {"text": "Lo llaman orgulloso."}]}, {"index": 8, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Dar a alguien el tratamiento que se expresa."}, "examples": [{"text": "Ll\u00e1mame de t\u00fa."}]}, {"index": 9, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Designar a alguien para ocupar un puesto, desempe\u00f1ar un cargo o ejercer un derecho."}, "examples": [{"text": "Fue llamada a suceder a su hermano."}]}, {"index": 10, "category": {"abbr": "tr.", "text": "verbo transitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Atraer a alguien o algo."}, "examples": [{"text": "El chocolate no me llama en absoluto."}]}, {"index": 11, "category": {"abbr": "intr.", "text": "verbo intransitivo"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Hacer una se\u00f1al sonora en una puerta, golpe\u00e1ndola o accionando un instrumento sonoro, para que alguien la abra."}, "examples": []}, {"index": 12, "category": {"abbr": "prnl.", "text": "verbo pronominal"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [], "sentence": {"text": "Tener el nombre o la denominaci\u00f3n que se expresa."}, "examples": []}, {"index": 13, "category": {"abbr": "prnl.", "text": "verbo pronominal"}, "is": {"adjective": false, "adverb": false, "interjection": false, "noun": false, "pronoun": false, "verb": true}, "abbreviations": [{"abbr": "Mar.", "text": "Marina"}, {"abbr": "desus.", "text": "desusado"}], "sentence": {"text": "Dicho del viento: Cambiar de direcci\u00f3n hacia la parte que se expresa."}, "examples": []}], "complex_forms": [], "other_entries": [{"text": "treta del llamar", "link": "https://dle.rae.es/?id=abLU9KP#40fzk3z"}], "conjugations": {"verb": "llamar", "conjugations": {"Formas no personales": {"Infinitivo": "", "Gerundio": "", "Participio": "", "": "llamado"}, "Indicativo": {"Presente": {"yo": "llamo", "t\u00fa / vos": ["llamas", "llam\u00e1s"], "usted": "llama", "\u00e9l, ella": "llama", "nosotros, nosotras": "llamamos", "vosotros, vosotras": "llam\u00e1is", "ustedes": "llaman", "ellos, ellas": "llaman"}, "Copret\u00e9rito": {"yo": "llamaba", "t\u00fa / vos": "llamabas", "usted": "llamaba", "\u00e9l, ella": "llamaba", "nosotros, nosotras": "llam\u00e1bamos", "vosotros, vosotras": "llamabais", "ustedes": "llamaban", "ellos, ellas": "llamaban"}, "Pret\u00e9rito": {"yo": "llam\u00e9", "t\u00fa / vos": "llamaste", "usted": "llam\u00f3", "\u00e9l, ella": "llam\u00f3", "nosotros, nosotras": "llamamos", "vosotros, vosotras": "llamasteis", "ustedes": "llamaron", "ellos, ellas": "llamaron"}, "Futuro": {"yo": "llamar\u00e9", "t\u00fa / vos": "llamar\u00e1s", "usted": "llamar\u00e1", "\u00e9l, ella": "llamar\u00e1", "nosotros, nosotras": "llamaremos", "vosotros, vosotras": "llamar\u00e9is", "ustedes": "llamar\u00e1n", "ellos, ellas": "llamar\u00e1n"}, "Pospret\u00e9rito": {"yo": "llamar\u00eda", "t\u00fa / vos": "llamar\u00edas", "usted": "llamar\u00eda", "\u00e9l, ella": "llamar\u00eda", "nosotros, nosotras": "llamar\u00edamos", "vosotros, vosotras": "llamar\u00edais", "ustedes": "llamar\u00edan", "ellos, ellas": "llamar\u00edan"}}, "Subjuntivo": {"Presente": {"yo": "llame", "t\u00fa / vos": "llames", "usted": "llame", "\u00e9l, ella": "llame", "nosotros, nosotras": "llamemos", "vosotros, vosotras": "llam\u00e9is", "ustedes": "llamen", "ellos, ellas": "llamen"}, "Futuro": {"yo": "llamare", "t\u00fa / vos": "llamares", "usted": "llamare", "\u00e9l, ella": "llamare", "nosotros, nosotras": "llam\u00e1remos", "vosotros, vosotras": "llamareis", "ustedes": "llamaren", "ellos, ellas": "llamaren"}, "Copret\u00e9rito": {}, "": {"yo": ["llamara", "llamase"], "t\u00fa / vos": ["llamaras", "llamases"], "usted": ["llamara", "llamase"], "\u00e9l, ella": ["llamara", "llamase"], "nosotros, nosotras": ["llam\u00e1ramos", "llam\u00e1semos"], "vosotros, vosotras": ["llamarais", "llamaseis"], "ustedes": ["llamaran", "llamasen"], "ellos, ellas": ["llamaran", "llamasen"]}}, "Imperativo": {"": {"t\u00fa / vos": ["llama", "llam\u00e1"], "usted": "llame", "vosotros, vosotras": "llamad", "ustedes": "llamen"}}}}}]}

enter image description here

By the moment I only was able to convert the dic to json:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

from pyrae import dle
import json

res = dle.search_by_word(word='llamar')
res = res.to_dict()

json_string = json.dumps(res)

data = json.loads(json_string)

print(data['sentence']) # throws error

This library pyrae allows me to get meaning of a spanish word.

I will appreciate any idea guys to solve it,
thanks so much.

>Solution :

import json

# open json
f = open('data_in.json')

# load json
data = json.load(f)

# print sentences
for i in data['articles']:
    for j in i['definitions']:
        print(j['sentence']['text'])

# close file
f.close()

Output:

Intentar captar la atención de alguien mediante voces, ruidos o gestos.
Realizar las operaciones necesarias para establecer comunicación telefónica con alguien.
Invocar, pedir auxilio a alguien.
Pedir a alguien que vaya a un lugar.
Despertar a alguien.
Incitar a alguien a que se comporte de una determinada manera...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading