MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_stopwords_in_short_text

Function get_stopwords_in_short_text

src/licensedcode/models.py:2215–2224  ·  view source on GitHub ↗

Return a sorted set of stopwords if ``text`` has less than ``min_tokens`` tokens and contains STOPWORDS or None. Stopwords in short texts may make exact matching inaccurate.

(text, min_tokens=4)

Source from the content-addressed store, hash-verified

2213
2214
2215def get_stopwords_in_short_text(text, min_tokens=4):
2216 """
2217 Return a sorted set of stopwords if ``text`` has less than ``min_tokens`` tokens and contains
2218 STOPWORDS or None.
2219 Stopwords in short texts may make exact matching inaccurate.
2220 """
2221 tokens = list(index_tokenizer(text, stopwords=frozenset(), preserve_case=False))
2222 if len(tokens) < min_tokens:
2223 tokens = set(tokens)
2224 return tokens.intersection(STOPWORDS)
2225
2226
2227def has_only_lower_license_keys(license_expression, licensing=Licensing()):

Callers 2

is_goodMethod · 0.90
validateMethod · 0.85

Calls 1

index_tokenizerFunction · 0.90

Tested by

no test coverage detected