MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / ngrams

Function ngrams

NLP/Text2SQL-BASELINE/text2sql/utils/text_utils.py:81–93  ·  view source on GitHub ↗

generate n-grams from tok_list Args: tok_list (TYPE): NULL n (TYPE): NULL Returns: TODO Raises: NULL

(tok_list, n)

Source from the content-addressed store, hash-verified

79
80
81def ngrams(tok_list, n):
82 """generate n-grams from tok_list
83
84 Args:
85 tok_list (TYPE): NULL
86 n (TYPE): NULL
87
88 Returns: TODO
89
90 Raises: NULL
91 """
92 for pos in range(len(tok_list) - n + 1):
93 yield tok_list[pos: pos + n]
94
95
96def remove_brackets(s):

Callers 1

text_utils.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected