Skip to content

[Feature request] Return offset mapping using tokenizer #425

Description

@arttorres0

Return offset mapping using tokenizer

Hi guys, awesome work with this project, it is helping us a lot! Is it possible to add the parameter "return_offset_mapping" to the Tokenizer class, just like in the Transformers python library?

Reason for request

The returned offsets are crucial for our project in Named Entity Recognition, as we need to associate the predicted tags with the original sentence (prior to tokenization). Currently we can only associate the predicted tags with the list of subtokens, as they are a 1-to-1 association, and we know that the list of subtokens ignore some elements, such as whitespaces, which are present in the original sentence.

Additional context

Reference for "return_offset_mapping" on Transformers python library: https://huggingface.co/docs/transformers/v4.35.2/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__.return_offsets_mapping

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions