Rae provides a tiny library to access the well-known spanish RAE dictionary programatically. It exposes an easy API for fetching words and a commnad line utility for looking up words in the official RAE dictionary. Access the demo site here
Rae requires node in order to work. Please, download and install it from node website
Then, open a terminal session and type:
# Local Setup
$ npm install rae
# Global Setup
$ npm install --global rae
For using the command line interface utility, just exec the rae process passing in the word as first parameter. A basci example is shown below.
$ rae repositorio
It will display the definition for the "repositorio"(repository in english) word.
Etimologia: (Del lat. repositorĭum, armario, alacena).
1. m. Lugar donde se guarda algo.
In order to use Rae in your personal project, you first need to import it. Rae exports a RaeClient which is a factory you can use to instantiate Rae clients. By default, it uses an HTTP Rae client. All clients have a search function to which you just need to pass in the word looking up for. Check the example below.
import Rae from 'rae';
const raeClient = Rae.create();
raeClient.search("repositorio").then((match) => ...);
Feel free to raise a PR either for fixing bugs and implementing new features. You can also help by increasing the test cases or documenting the project. All help is welcome.
Just make sure npm run validate
works before submitting your PR!