(span_or_token: Span | Token)
Get the text of a spaCy span or token, normalized depending on its characteristics.
    For proper nouns and acronyms, text is returned as-is; for everything else,
    text is lemmatized.
Get the text of a spaCy span or token, normalized depending on its characteristics.
    For proper nouns and acronyms, text is returned as-is; for everything else,
    text is lemmatized.
Get the text of a spaCy span or token normalized depending on its characteristics . For proper nouns and acronyms text is returned as - is ; for everything else text is lemmatized .
def get_normalized_text(span_or_token: Span | Token) -> str:
    """
    Get the text of a spaCy span or token, normalized depending on its characteristics.
    For proper nouns and acronyms, text is returned as-is; for everything else,
    text is lemmatized.
    """
    if isinstance(span_or_token, Token):
        return (
            span_or_token.text if preserve_case(span_or_token) else span_or_token.lemma_
        )
    elif isinstance(span_or_token, Span):
        return " ".join(
            token.text if preserve_case(token) else token.lemma_
            for token in span_or_token
        )
    else:
        raise TypeError(
            errors.type_invalid_msg(
                "span_or_token", type(span_or_token), Union[Span, Token]
            )
        )
def get_normalized_text ( span_or_token : Span | Token ) -> str : if isinstance ( span_or_token , Token ) : return ( span_or_token . text if preserve_case ( span_or_token ) else span_or_token . lemma_ ) elif isinstance ( span_or_token , Span ) : return " " . join ( token . text if preserve_case ( token ) else token . lemma_ for token in span_or_token ) else : raise TypeError ( errors . type_invalid_msg ( "span_or_token" , type ( span_or_token ) , Union [ Span , Token ] ) )