Skip to content

Commit bc41468

Browse files
committed
feat(sdk): add decode method to Spans
1 parent 9f5653e commit bc41468

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/isaacus/types/ilgs/v1/span.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,15 @@ class Span(BaseModel):
2626
The zero-based end index of the half-open span (i.e., the end is exclusive) of
2727
Unicode code points in the input text.
2828
"""
29+
30+
def decode(self, text: str) -> str:
31+
"""Decode the span from the given text.
32+
33+
Args:
34+
text (str): The input text from which to decode the span.
35+
36+
Returns:
37+
str: The substring of the input text corresponding to the span.
38+
"""
39+
40+
return text[self.start:self.end]

0 commit comments

Comments
 (0)