Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PySequence objects #659

Open
n1t0 opened this issue Mar 18, 2021 · 3 comments
Open

Improve PySequence objects #659

n1t0 opened this issue Mar 18, 2021 · 3 comments

Comments

@n1t0
Copy link
Member

n1t0 commented Mar 18, 2021

With #530 we made most of the components expose their attributes and allow their modification. We'd like to do the same for PySequence objects (both for Normalizer and PreTokenizer sequences).

In order to make these PySequence objects behave like a list, we'd need to implement the PySequenceProtocol with the __len__, __getitem__ and __setitem__ dunder methods. Unfortunately, these don't support using a PyRef at the moment (cf PyO3/pyo3#1206), and we need it to access the content of the base class.

This is necessary to allow behavior such as:

if isinstance(tokenizer.normalizer, Sequence):
    # Access a normalizer in the sequence
    print(tokenizer.normalizer[0])
    # Modify a normalizer in the sequence
    tokenizer.normalizer[1] = Lowercase()
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Apr 15, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2024
@ArthurZucker ArthurZucker reopened this Jun 11, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jul 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@ArthurZucker ArthurZucker reopened this Jul 24, 2024
@github-actions github-actions bot removed the Stale label Jul 25, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants