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

Method normalize

src/textcode/gibberish.py:43–47  ·  view source on GitHub ↗

Return only the subset of chars from accepted_chars. This helps keep the model relatively small by ignoring punctuation, infrequenty symbols, etc.

(self, line)

Source from the content-addressed store, hash-verified

41 setattr(self, key, value)
42
43 def normalize(self, line):
44 """ Return only the subset of chars from accepted_chars.
45 This helps keep the model relatively small by ignoring punctuation,
46 infrequenty symbols, etc. """
47 return [c.lower() for c in line if c.lower() in accepted_chars]
48
49 def ngram(self, n, l):
50 """ Return all n grams from l after normalizing """

Callers 11

ngramMethod · 0.95
detect_gibberishMethod · 0.95
percent_gibberishMethod · 0.95
gibberish_pctMethod · 0.95
as_unicodeFunction · 0.45
toasciiFunction · 0.45
getMKColorMethod · 0.45
getFieldPositionsMethod · 0.45
newContextFunction · 0.45

Calls

no outgoing calls

Tested by 2

getMKColorMethod · 0.36
getFieldPositionsMethod · 0.36