@giancosta86/jardinero
v2.0.0
Published
Extensible web stack in TypeScript for exploring natural languages
Downloads
4
Maintainers
Readme
JardineroJS
Extensible web stack in TypeScript for exploring natural languages
🌹JardineroJS is a web architecture, based on NodeJS, focused on building SQL-based dictionaries for the analysis of natural languages.
It is entirely written in TypeScript, with a frontend enabling users to:
create subsequent versions of custom dictionaries, by extracting terms from a set of arbitrary input pages - such as Wiktionary - and storing the data into SQLite databases
perform sophisticated queries, in order to explore a wide variety of linguistic aspects of the newly-created dictionary - especially in the domain of morphology
The architecture is designed to be fully extensible - via plugins, that are responsible for defining:
how to extract terms from an arbitrary source
how to insert the terms into SQL tables - and how to retrieve them: every plugin has its own SQLite database
Furthermore, plugins can be created quite easily, via the open source JardineroJS-sdk.
Installation
JardineroJS has been tested with NodeJS 16 LTS and NodeJS 18.
It should be installed as a global package; in particular:
npm install -g @giancosta86/jardinero
or
yarn global add @giancosta86/jardinero
Then, you need to ensure that the global bin directory - as defined by your package manager settings - belongs to your PATH environment variable; for example, in the case of Yarn, you can find out this directory via the following command:
yarn global bin
After that, adding a directory to your PATH environment variable depends on your operating system - please, follow the most recent documentation.
Running JardineroJS
JardineroJS cannot run by itself: it requires a plugin even to start - because the data source, together with the related algorithms - is provided by the plugin.
Consequently, to run JardineroJS, you first need to install a plugin.
Installing a plugin
Usually, plugins should be installed as global libraries - using the package manager you prefer: actually, you can even install JardineroJS via a package manager and later install its plugins via another one - the loading mechanism makes them totally unrelated.
Plugins need to be installed only once: thereafter, you can run JardineroJS as many times as you wish
For example, to install the CervantesJS plugin - devoted to the analysis of the Spanish language via Wikcionario:
npm i -g @giancosta86/cervantes
or
yarn global add @giancosta86/cervantes
Similarly, if you want to install RayonJS - the plugin for exploring the French language - you can run:
npm i -g @giancosta86/rayon
or
yarn global add @giancosta86/rayon
As a matter of fact, JardineroJS only requires the module exporting the plugin class - as explained in the JardineroJS-sdk documentation: consequently, if you are a plugin developer, you only need the compiled .js files within your plugin project directory - with no need for packaging.
Running a plugin
jardinero <linguistic module id>
where <linguistic module id> is usually the directory of the installed package providing the plugin you want to use.
More concretely, in both Bash and PowerShell, if you are using Yarn to install plugins, you can run:
jardinero "$(yarn global dir)/node_modules/<linguistic module package>"
For example, to start JardineroJS after installing the @giancosta86/cervantes plugin for Spanish, you'll just need this command:
jardinero "$(yarn global dir)/node_modules/@giancosta86/cervantes"
Similarly, to run the @giancosta86/rayon plugin for French, you should execute this command:
jardinero "$(yarn global dir)/node_modules/@giancosta86/rayon"
More technically, Jardinero only requires the module id (which can be the file-system path) of the module exporting the linguistic plugin, as expected by the
resolve()
function and in the way described by the JardineroJS-sdk project. In particular, if you are a plugin developer, you can simply pass the path to the compiled .js file of your plugin module, to test it before packaging.
Developing custom plugins
Creating a plugin for JardineroJS is as easy as extending an abstract class - and documented in detail by the open source JardineroJS-sdk project.
A vast architecture of TypeScript projects
🌹JardineroJS is a huge architecture, consisting of several NPM packages.
You are invited to explore them - because they manage to be fairly general-purpose, and they are also thoroughly tested.
The complete list of the remanining NPM packages in the JardineroJS architecture is as follows:
For convenience, a workspace file for VS code - JardineroJS - is provided within the project folder and contains the relative paths, matching the GitHub naming, of all the projects within the architecture.
Further references
If you wish, please feel free to have a look at the original Python edition as well.