JavaScript API for spaCy with Python REST API

JavaScript interface for accessing linguistic annotations provided by spaCy. This project is mostly experimental and was developed for fun to play around with different ways of mimicking spaCy's Python API.

The results will still be computed in Python and made available via a REST API. The JavaScript API resembles spaCy's Python API as closely as possible (with a few exceptions, as the values are all pre-computed and it's tricky to express complex recursive relationships).


const spacy = require('spacy'); (async function() { const nlp = spacy.load('en_core_web_sm'); const doc = await nlp('This is a text about Facebook.'); for (let ent of doc.ents) { console.log(ent.text, ent.label); } for (let token of doc) { console.log(token.text, token.pos, token.head.text); } })();
Author info

Ines Montani


Categories nonpython

Submit your project

If you have a project that you want the spaCy community to make use of, you can suggest it by submitting a pull request to the spaCy website repository. The Universe database is open-source and collected in a simple JSON file. For more details on the formats and available fields, see the documentation. Looking for inspiration your own spaCy plugin or extension? Check out the project idea label on the issue tracker.

Read the docsJSON source