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

Slicing in SurprisalArray is not fully Pythonic #6

Open
aalok-sathe opened this issue Dec 21, 2022 · 0 comments
Open

Slicing in SurprisalArray is not fully Pythonic #6

aalok-sathe opened this issue Dec 21, 2022 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@aalok-sathe
Copy link
Owner

Need to either: [1] make a note somewhere or [2] add a warning or [3] add a workaround implementation that slicing doesn't exactly work the same way as it does with Python lists or numpy arrays.

  • [0:None] has undefined behavior
  • [:] has undefined behavior
  • [x:-1] has undefined behavior

What does work: providing actual or overshooting indices to characters or words within the stimulus/input.

  • [1:3, 'char'] works fine and returns surprisal over all tokens overlapping with chars 1:3
  • [0:99, 'char'] works fine and returns surprisal over all tokens that appear within the first 99 chars
@aalok-sathe aalok-sathe added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 21, 2022
@aalok-sathe aalok-sathe self-assigned this Dec 21, 2022
@aalok-sathe aalok-sathe changed the title Slicing in SurprisalArray is not fully Python array-like Slicing in SurprisalArray is not fully Pythonic Dec 21, 2022
aalok-sathe added a commit that referenced this issue Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant