@vtex/gosling
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

Gosling

HONK!

Gosling is an entity extractor, able to parse input strings and return structured data.

Right now Gosling can only extract quantities (both numbers and measurement units).

Why Gosling?

No, this is not a package for fans, or by fans, of Ryan Gosling 🧔‍♂️.

The name came from Duckling, which is an entity extractor created and maintained by Facebook.

We needed an entity extractor that was more flexible and easily configured without needing code changes. Also, we'd like it to be in Node.JS, to avoid extra HTTP calls to a separate service such as Duckling.

So we decided to build Gosling, which is similar, but defintely not the same as Duckling.

This is a DUCKLING:

Duckling

And THIS is a GOSLING:

Gosling

So now you see: clearly very different.

Usage

To use Gosling with the default configurations, you only need to run the following:

import Gosling from '@vtex/gosling';

const gosling = new Gosling();
gosling.extractQuantities(yourText);

Languages

The default configuration is (mostly) language-agnostic, since it only extracts actual numeric values and abbreviated measurement units.

If you need a smarter extractor, capable of understanding numbers in full and non abbreviated unit names, you can either use one of our language presets or build your own.

Gosling language presets

Gosling provides some preset configurations for a few languages (right now only PT). Check out the following example on how to use them:

import Gosling from '@vtex/gosling';
import RulesConfigPt from '@vtex/gosling/dist/pt';

const gosling = new Gosling(RulesConfigPt);
gosling.extractQuantities(yourTextInPortuguese);

Build your own rules

If you need to detect entities for a language that Gosling doesn't support by default, or to extend its functionality to a different use case, you can easily write your own rules and run Gosling with them.

To do that, just take a look at the way the PT or ES rules are defined.

After defining the rules, all you need is to create a new Gosling instance that uses them, for example:

const gosling = new Gosling(YourCustomRules);

Now you can use Gosling as usual, but it will extract quantities according to your own configuration.

Readme

Keywords

none

Package Sidebar

Install

npm i @vtex/gosling

Weekly Downloads

0

Version

0.0.11

License

ISC

Unpacked Size

73.4 kB

Total Files

33

Last publish

Collaborators

  • jardelymaris
  • denissilvavtex
  • eduardocesb
  • enzomerca
  • vinhags
  • zaedyvtex
  • filafb
  • bastotec
  • arthurtriis1vtex
  • geraldo.fernandes
  • georgebrindeiro
  • filipewl
  • emersonvtex
  • rodrigo.albuquerque
  • viniciuslouzadavtex
  • npedrosovtex
  • myllena.alves
  • mendescamara
  • mauro.takeda
  • lpolon
  • gianvittorio
  • eduardoformiga
  • vcnovaes
  • dpzvtex
  • vtexlab-user
  • wender
  • natamelo
  • mairatma
  • mayzabel
  • augusto.lazaro
  • rafarubim
  • gustavorosolem
  • arthurepc
  • jeymisson
  • victorhmp
  • lurian
  • arturpimentel
  • anitavincent
  • brunojdo
  • lucasecdb
  • matheusps
  • emersonlaurentino
  • viniagostini
  • lucasaarcoverde
  • lariciamota
  • icazevedo
  • fabits
  • mateuspontes
  • gmantiqueira
  • vitorlgomes
  • rodolfoams
  • policarpo
  • marcelovicentegc
  • maianabt
  • jeffersontuc
  • hiagolcm
  • william.silva