From 8954459bb20a96b718ffc0fb3f2360860b39d7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aalok=20Sathe=20=7C=20=E0=A4=86=E0=A4=B2=E0=A5=8B=E0=A4=95?= <10784697+aalok-sathe@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:29:44 -0500 Subject: [PATCH] Minor non-functional edits to satisfy linter --- surprisal/surprisal.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/surprisal/surprisal.py b/surprisal/surprisal.py index 4faa520..8571378 100644 --- a/surprisal/surprisal.py +++ b/surprisal/surprisal.py @@ -76,8 +76,9 @@ def __getitem__( if slctype == "char": fn = partial(hf_pick_matching_token_ixs, span_type="char") - elif slctype == "word": + else: # if slctype == "word": # we already did error handling up above fn = partial(hf_pick_matching_token_ixs, span_type="word") + if isinstance(slc, int): slc = slice(slc, slc + 1) @@ -124,10 +125,12 @@ def __getitem__( slc, slctype = slctup, "char" if slctype == "char": - raise NotImplementedError('WIP; currently only supports "word" spans') + raise NotImplementedError('NGramSurprisal currently only supports "word" spans') # fn = partial(hf_pick_matching_token_ixs, span_type="char") if slctype == "word": token_slc = slc + else: + token_slc = None if isinstance(slc, int): slc = slice(slc, slc + 1)