Keyterms Utilities¤
terms_to_strings(terms: Iterable[Span | Token | str], by: str | Callable[[Span | Token | str], str] | None) -> Iterable[str]
¤
Transform a sequence of terms as spaCy Tokens, Spans, or strings into strings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
terms
|
Iterable[Span | Token | str]
|
Terms to transform into strings. |
required |
by
|
str | Callable[[Span | Token | str], str]
|
Method by which terms are transformed into strings.
If "orth" or None, terms are represented by their text exactly as written;
if "lower", by the lowercased form of their text;
if "lemma", by their base form w/o inflectional suffixes;
if a callable, must accept a |
required |
Yields:
| Type | Description |
|---|---|
Iterable[str]
|
Iterable[str]: Next term in |
Source code in lexos/topwords/keyterms/keyterms_util.py
is_unicode_punctuation(ch: str) -> bool
¤
Return True if ch is a Unicode punctuation character.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ch
|
str
|
Single character to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if |