This is the early version of the JavaScript utilities for parsing an arbitrary string (ideally, in the natural language) into the Optimade filter query. An intermediate layer is the MPDS search query object notation, see the MPDS platform and its API documentation.
To see how it works, try to paste an example string
cubic, disordered perovskites with actinides and chlorine
into the main search field of the MPDS, and it will be correctly recognized and assigned to the following classes:
{
"elements": "Cl",
"classes": "disordered, perovskite, actinoid",
"lattices": "cubic"
}
Used by:
npm i optimade-mpds-nlp --save
The code is fully isomorphic and standalone. The following MPDS categories (out of 15) can be currently detected in a free-form text:
- chemical formulae (standard and anonymous)
- chemical elements
- crystalline lattices
- physical properties (see MPDS hierarchy)
- materials classes (an umbrella term for different various classifications)
The algorithm is mostly heuristic, which means it may or may not work for your particular keywords.
One has to import the only class from the module, instantiate, and use the guess
method:
const converter = NLP();
const mpds_query = converter.guess(input_str);
The following Optimade query keywords can be currently obtained calling converter.to_optimade(mpds_query)
:
chemical_formula_anonymous
chemical_formula_reduced
elements HAS ALL "..."
nelements=...
There might be some other MPDS-specific Optimade keywords with the _mpds_
prefix implemented, being not the part of the Optimade standard though.
MIT © Tilde Materials Informatics and Materials Platform for Data Science