Skip to main content

character span label to tokenized base label for Japanese text

Project description

noyaki

Converts character span label information to tokenized text-based label information.

Installation

$ pip install noyaki

Usage

Pass the tokenized text and label information as arguments to the convert function.

import noyaki

label_list = noyaki.convert(
        ['明日', 'は', '田中', 'さん', 'に', '会う'],
        [[3, 5, 'PERSON']]
    )

print(label_list)
# ['O', 'O', 'U-PERSON', 'O', 'O', 'O'] 

If you want to remove the subword symbol (eg. ##), specify the subword argument.

import noyaki

label_list = noyaki.convert(
        ['明日', 'は', '田', '##中', 'さん', 'に', '会う'],
        [[3, 5, 'PERSON']],
	subword="##"
    )

print(label_list)
# ['O', 'O', 'B-PERSON', 'L-PERSON', 'O', 'O', 'O']

If you want to use IOB2 tag format, specify the scheme argument.

import noyaki

label_list = noyaki.convert(
        ['明日', 'は', '田', '##中', 'さん', 'に', '会う'],
        [[3, 5, 'PERSON']],
	scheme="IOB2"
    )

print(label_list)
# ['O', 'O', 'B-PERSON', 'I-PERSON', 'O', 'O', 'O']

Note

Only Japanese is supported.
supported tag formats are follow:

  • BILOU
  • IOB2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

noyaki-0.2.0.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

noyaki-0.2.0-py2.py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page