MCPcopy Create free account
hub / github.com/PAIR-code/lit / _scramble

Function _scramble

lit_nlp/components/scrambler.py:32–39  ·  view source on GitHub ↗
(val: str)

Source from the content-addressed store, hash-verified

30
31
32def _scramble(val: str) -> str:
33 words = val.split(' ')
34 shuffled = copy.deepcopy(words)
35 while True:
36 random.shuffle(shuffled)
37 if shuffled != words:
38 break
39 return ' '.join(shuffled)
40
41
42class Scrambler(lit_components.Generator):

Callers 1

generateMethod · 0.85

Calls 1

shuffleMethod · 0.80

Tested by

no test coverage detected