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

labeling-tool

v2.0.6

Published

Project agnostic tool for documents labeling

Downloads

440

Readme

labeling-tool

labeling-tool is powerful package built with React. It is designed for data labeling to assist with document markup tasks and training ML models.

Data labeling involves adding relevant keywords to unstructured data, such as text or images, enabling machines to automatically recognize and categorize the information. As the crucial first step in the ML lifecycle, data labeling forms the foundation for accurate predictive models.

The labeling-tool package simplifies editing table layouts and labeling documents, ultimately improving data extraction processes and preserving document structure.

img.png

Features and Benefits

Features

  • Import/Export Markup: labeling-tool allows users to seamlessly import and export markup data.
  • Feature-rich interface: A comprehensive panel with document controls such as zoom, undo, and pointer tool for selecting and moving markup.
  • Markup Creation: Easily create data markups within the document.
  • Merge/Split Table Cells: Allows managing table cells manually as needed during the labeling process.
  • Data Extraction: labeling-tool interface allows to extract data from the labeling tool (when the appropriate API handler is passed) improving efficiency and saving time.
  • Editable Extracted Content: Users have the ability to create, modify, and delete extracted content for each label, providing greater flexibility over the labeling process.
  • Delete Markup: Allows users to delete unnecessary or incorrect markup to maintain organized and accurate data labeling.
  • Labels Assignment: Assign selected labels to existing fields, simplifying data organization and extraction.
  • Markup Object Panel: Easily view and manage markup objects in a dedicated panel, with JSON preview available.
  • Hotkeys: Enhance productivity by using hotkeys to quickly access different tools.
  • Table Detection: Allows automatic table detection feature within the document (when the appropriate API handler is passed).
  • AutoSave: Ensure the security of your work with an autosave functionality that periodically saves markup data automatically.

Benefits

  • Streamlines data labeling, leading to better ML model training and development.
  • Preserves document content structure, ensuring the accuracy of extracted data.
  • Simplify data labeling and extraction process.
  • Enhances workflow efficiency, saving time and effort during the ML lifecycle.

API

The root LabelingTool component accepts the following prop to configure and customize its behavior:

config (required) The config object contains all necessary settings and configurations.

config object

| Key | Type | Required | Description | |---------------|-----------------------------------|----------|----------------------------------------------------------------------------| | api | Object | Yes | Contains functions related to API interactions | | addFieldForm | () => ReactNode | No | Renders a custom form to create a new document fields | | document | Object | Yes | Describes the document being labeled | | events | Object | No | Contains possible handlers for events | | fields | Array of objects | Yes | Defines the available document fields | | markup | Object | No | Defines existed markup objects | | ocr | Object | No | Contains configuration related to Optical Character Recognition (OCR) | | settings | Object | No | Settings related to the appearance and capabilities of the labeling-tool |

document object

| Key | Type | Required | Description | |------------|------------|----------|--------------------------------------------------------------------------------------------------------| | extraName | string | No | Document extra name (displayed on UI) | | engine | string | Yes | The primary OCR engine for handling data extraction | | language | string | No | The document language | | name | string | Yes | Document name (displayed on UI) | | pages | string[] | Yes | List of images, for ex. ['https://domain/doc-page.png'] |

field object

| Key | Type | Required | Description | |-----------|-----------|---------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | code | string | Yes | Field code | | fieldType | string | Yes | Field type, see possible values | | fieldMeta | Object | No | Additional Field data depending on Field type. See enumFieldMetaShape, listFieldMetaShape, pairFieldMetaShape here | | index | number | Yes - only for fieldType list | Field index | | name | string | Yes | Field name | | required | boolean | Yes | Define whenever field is required |

ocr object

| Key | Type | Required | Description | |-----------|-------------------------------------|---------|---------------------------------------------------------------------------------------------------------------------| | engines | { code: string, name: string }[] | No | The list of the available OCR engines | | languages | { code: string, name: string }[] | No | The list of the available languages |

api object

| Key | Type | Required | Description | |--------------|-------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | close | Function | Yes | The function handles the Labeling Tool closing | | detectTables | Function | No | The function handles automatic table detection.Required only in case the tool for Table detection is available.Format: function(imageUrl, detectCoords){} | | getImage | Function | No | The function for getting the data of the document image.Format: (imageUrl) => URL.createObjectURL(imageBlob) | | notify | Object | No | Contains functions for showing notifications: error, info, success, warning.Ex. { success: (text) => console.log(text) } | | ocrTable | Function | No | The function handles extracting table data.Required only in case Table tool is available and ocr prop is passed as well).Format: function(engine, imageUrl, markupTable, language){} | | ocrText | Function | No | The function handles extracting labels data.Required only in case Label tool is available and ocr prop is passed as well).Format: function(engine, imageUrl, labelCoords, language){} | | save | Function | No | The function handles data extraction and markup saving.Format: function(markup, rotationAngles, language){} | | saveMarkup | Function | Yes | The function handles markup saving.Format: function(markup, rotationAngles, language, fields){} |

markup object

| Key | Type | Required | Description | |------------|-----------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | labels | { label }[] | No | The list of the existed markup labels.Required only in case Label tool is available | | tables | { table }[] | No | The list of the existed markup tables.Required only in case Table tool is available |

settings object

| Key | Type | Required | Description | |------------|-------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | features | string[] | No | List of the available features. Possible values. | | mode | 'default' or 'markup' | No | Represents the current mode.Markup mode enables the possibility to extract and see labels' content | | panels | string[] | No | List of the panels displayed on UI.Toolbar panel displayed in the header and contains available tools.Markup sidebar locates in the right sidebar, contains markup objects properties and possible actions.Left sidebar displays markup objects list | | tools | string[] | No | List of the available tools. Possible values |

events object

| Key | Type | Required | Description | |------------|--------------|----------|--------------------------------------------------------| | onClose | Function | No | The callback function, executed on Labeling Tool close |

Check the working example of the config here. This config could be used for playing with LabelingTool package.

Requirements

Min NodeJS version is 14.16.0

Installation and Usage

To get started, follow these steps:

  1. Install the package:
# If you use npm:
npm install labeling-tool

# Or if you use Yarn:
yarn add labeling-tool
  1. Then import the LabelingTool package and use as in the example:
import { LabelingTool } from 'labeling-tool'

function App() {
  return (
    <div className="App">
      <LabelingTool config={yourConfigHere} />
    </div>
  )
}

export default App
  1. Update yourConfigHere with your desired configurations.

Demo

There is a demo hosted on Demo Labeling Tool which allows to check labeling-tool package.

License

labeling-tool is licensed under the MIT License.