MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / word_ngrams

Function word_ngrams

test/general/lm_eval/decontamination/janitor.py:39–43  ·  view source on GitHub ↗

Splits a string into ngram words

(s, n)

Source from the content-addressed store, hash-verified

37
38
39def word_ngrams(s, n):
40 """Splits a string into ngram words"""
41 tokens = s.split() # not a generator :(
42 ngram_seqs = form_ngrams(iter(tokens), n)
43 return (" ".join(ngram) for ngram in ngram_seqs)
44
45
46# Does character sequences only - combined faster function to play around with later

Callers 2

get_train_overlapFunction · 0.85

Calls 1

form_ngramsFunction · 0.85

Tested by

no test coverage detected