Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/botsquad/sentence-annotator

Typescript React component to annotate (label) sentences
https://github.com/botsquad/sentence-annotator

Last synced: 15 days ago
JSON representation

Typescript React component to annotate (label) sentences

Awesome Lists containing this project

README

        

# Sentence Annotator component

[![Build Status](https://travis-ci.com/botsquad/sentence-annotator.svg?branch=master)](https://travis-ci.com/botsquad/sentence-annotator)
[![npm (scoped)](https://img.shields.io/npm/v/@botsquad/sentence-annotator)](https://www.npmjs.com/package/@botsquad/sentence-annotator)

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

```javascript
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(initial)

return (


SentenceEditor component




)
}

ReactDOM.render(, 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.