npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fabilab/atlasapprox-nlp

v0.3.4

Published

[![npm version](https://badge.fury.io/js/@fabilab%2Fatlasapprox-nlp.svg)](https://badge.fury.io/js/@fabilab%2Fatlasapprox-nlp)

Downloads

99

Readme

npm version

Cell Atlas Approximations - Natural Language Processing

Cell atlases are single cell data sets on the scale of whole organisms. There are many ways for humans to query these atlases using natural language (e.g. English), however human-atlas interactions are currently limited to Python or R programmers.

This project enables biologists, doctors, and anyone else to ask questions in their natural language (starting from English) and convert the question into a formalised query for an atlas approximation. This functionality is used internally in our Human Interface web application. Intents understood via NLP in this library are then forwarded to our JavaScript API contained in the @fabilab/atlasapprox npm package.

Installation

npm install @fabilab/atlasapprox-nlp

If you want to use query the JavaScript API based on the answers you received here, you'll need to install that package as well:

npm install @fabilab/atlasapprox

Usage

// ES6 (e.g. in React development)
import { AtlasApproxNlp } from '@fabilab/atlasapprox-nlp';
// CommonJS variant
//let { AtlasApproxNlp } = require('@fabilab/atlasapprox-nlp');

let nlp = new AtlasApproxNlp();

(async () => {
  await nlp.initialise();

  // NOTE: Multiple initalisations are unnecessary but tolerated

  // Ask a question
  let response = await nlp.ask("What measurement types are available?");
  console.log(response);

  // Reset context to a virgin state
  nlp.reset();

})();

AtlasapproxNlp is the main object wrapping the excellent nlpjs library. Object instantiation is synchronous, but initialisation of the nlpjs library is async.

Architechture

  • src/corpus.json is the training corpus containing utterances (questions), entities, etc.
  • src/app.js contains most of the wrapper code, including the buildAPIParams, buildAnswer, and ask functions.
  • src/tail_node.js contains the object constructor and initalisation methods to be exported in CommonJS format.
  • src/tail_window.js is an older version that relies on a global window.nlp object (deprecated).

Development

  • Add utterances etc. to the corpus.
  • Test with npm run testCorpus, adding test questions to test/trainAndTest.js if needed.
  • Once this works, you can pre-train the production model using npm run train. npm run train saves the model in gists/model/model.nlp which is a git submodule, and pushed a new commit to the gist repo.
  • Get the URL of the raw file on gist and substitute it on top of src/app.js.
  • Run npm run testNpm to test a webpack-like app that loads the module using CommonJS.

(deprecated):

  • npm run testBrowser creates a browser-compatible index.js and an index.html into build and opens it in Firefox. Opening the inspector shows an example call and exposes a function called answerFun to probe the model by hand.