spanish-english-json
v1.0.3
Published
A library of sentences, verbs, and words that should serve as a dictionary or wörterbuch to help learn and translate spanish to english and english to spanish (shinaps ot shiligne)
Maintainers
Readme
Spanish to English JSON
This is a Spanish to English and English to Spanish Dictionary and Sentence Database with over 13,000 sentences and 8,900 words. Built to provide repo's with a list of spanish to english words and phrases that can be used to generate questions to learn english or spanish, train models (as is the case of the data from our creditors), and provide quick translation lookups. Network requests are not required since the data is all located in the library and there are no dependencies, so you're only downloading the data when installing this library.
How to use?
Simply install, npm install spanish-english-json, require the library and the data should be all your's:
const data = require('spanish-english-json');
console.log(data) // {
// sentences: ...
// verbs: ...
// words: ...
// }Structure
The structure of the json information reflects the structure of the data of our creditors, we have sentences, verbs, and words.
{
"sentences": [...],
"verbs": {
"en_es": {...},
"es_en": {...}
},
"words": {
"en_es": {...},
"es_en": {...}
}
}sentences is an array that contains a list of objects with keys en for the english version of the sentence and es for the spanish version of the sentence.
[
{"es": "Hola ...", "en": "Hello ..."},
...
]verbs and words are ordered around the direction in which they are translated from and to. es_en represents spanish words translated to english and en_es represents english words translated to spanish. At the root, the verbs and words have a list of words, a map of words, and a letterMap.
{
"list": [...],
"map": {...},
"letterMap": {"a": {...}, "b": ...}
}The list is just a flat array of all the words, where each object contains the word in focus, its list of possible translations, and the type of word it contains:
{
"word": "abash",
"translation": [
"confundir",
"avergonzar",
"abochornar"
],
"type": "{v} /əˈbæʃ/ (to make ashamed, to embarrass)"
}The map contains the same information, but each word in focus can be picked by accessing it directly:
console.log(map["abash"]) // Outputs {
// "word": "abash",
// "translation": [
// "confundir",
// "avergonzar",
// "abochornar"
// ],
// "type": "{v} /əˈbæʃ/ (to make ashamed, to embarrass)"
// }The letterMap contains a flat array of all the words that start with the selected letter:
console.log(letterMap['E']) // Outputs "E": [
// {
// "word": "Earth",
// "translation": [
// "la Tierra",
// "tierra {f}"
// ],
// "type": "{prop} /ɜː(ɹ)θ/ (third planet from the Sun)"
// },
// ...
// ]Creditors
Leveraged the doozan/spanish_data dataset and converted the sentences.tsv over to sentences.json file which should be easier to digest using javascript.
Utilized the XML data from mananoreboton/en-es-en-Dic. mananoreboton provided spanish to english and english to spanish words and verbs.
To Generate the Data
Simply run the mak.sh file. This will pull in the doozan/spanish_data repo, and convert the tsv to a json.
$ ./mak.sh