def find_span(input_text: str, pattern: Any,
                prefix_len: int) -> Tuple[int, int]:
    """Find span corresponding to actual subj or obj strings."""
    match = pattern.search(input_text)
    span_start = match.start() + prefix_len + 1
    # We want inclusive spans, hence -2 instead of -1
    span_end = match.end() - 2
    return (span_start, span_end)
Find span corresponding to actual subj or obj strings.
language/mentionmemory/data/prepare_webred.py