0.6.1 • Published 3 years ago

@botsquad/sentence-annotator v0.6.1

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Sentence Annotator component

Build Status npm (scoped)

This is a React component for creating a text input box which understands Dialogflow's user utterance JSON format, and allows one to use an interface similar to Dialogflow's utterance editor as a React component.

Example code

import React, { useState } from "react";
import ReactDOM from "react-dom";

import { SentenceAnnotator } from '@botsquad/sentence-annotator';

const initial = {
  data: [
    {
      text: 'whatever you do, please please do remember that my ',
    },
    {
      text: 'nickname',
      name: 'type',
      entity: '@name-type',
    },
    {
      text: ' is ',
    },
    {
      text: 'pete',
      name: 'nick-name',
      entity: '@nick-name',
    }
  ],
};

const Example = () => {
  const [sentence, setSentence] = useState<Sentence>(initial)

  return (
    <div>
      <h1>SentenceEditor component</h1>
      <SentenceAnnotator value={sentence} onChange={setSentence} autoFocus />
    </div>
  )
}

ReactDOM.render(<Example />,  document.getElementById("root"))
);

There is also a StringSentenceAnnotator component which works similarly, but converts the result to a string; which contains the annotations in markdown syntax.

0.6.1

3 years ago

0.6.0

3 years ago

0.5.1

5 years ago

0.4.13

5 years ago

0.5.0

5 years ago

0.4.12

5 years ago

0.4.11

5 years ago

0.4.10

5 years ago

0.4.9

5 years ago

0.4.8

5 years ago

0.4.7

5 years ago

0.4.6

5 years ago

0.4.5

5 years ago

0.4.4

5 years ago

0.4.1

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago