@botonic/plugin-ner
TypeScript icon, indicating that this package has built-in type declarations

0.20.0 • Public • Published

Botonic Plugin NER

What does this plugin do?

Botonic Plugin NER uses the trained models to recognize named entities in the input text.

Setup

Installing the plugin

From your project, install the plugin by using the following command:

npm install @botonic/plugin-ner

Note: Windows users should first use the command npm install --global --production windows-build-tools --vs2015

Requiring the plugin

The plugin must be required in src/plugins.js and the locales of the trained models must be defined in their options.

export const plugins = [
  {
    id: 'ner',
    resolve: require('@botonic/plugin-ner'),
    options: {
      locales: ['en', 'es'],
    },
  },
]

Use

The plugin has just added the recognized entities. Now you can use them within actions to create better conversational flows:

import { RequestContext, Text } from '@botonic/react'
import React from 'react'

export default class extends React.Component {
  static contextType = RequestContext

  static async botonicInit({ input }) {
    return { entities: input.entities }
  }

  render() {
    const products = this.props.entities.filter(e => e.label == 'product')
    if (products.length === 0) {
      return (
        <>
          <Text>Which product do you want to return?</Text>
        </>
      )
    } else {
      return (
        <>
          <Text>
            Do you have the ticket of the products:{' '}
            {products.map(e => e.text).join(', ')}?
          </Text>
        </>
      )
    }
  }
}

Package Sidebar

Install

npm i @botonic/plugin-ner

Weekly Downloads

1

Version

0.20.0

License

MIT

Unpacked Size

27.7 kB

Total Files

34

Last publish

Collaborators

  • oraventos
  • agimenezhubtype
  • ahubstre
  • ericmarcos
  • khaeshah
  • mrabat
  • elozano
  • ainavendrell