MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / _strip_spaces

Function _strip_spaces

demo/BERT/helpers/data_processing.py:253–262  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

251 # can fail in certain cases in which case we just return `orig_text`.
252
253 def _strip_spaces(text):
254 ns_chars = []
255 ns_to_s_map = collections.OrderedDict()
256 for (i, c) in enumerate(text):
257 if c == " ":
258 continue
259 ns_to_s_map[len(ns_chars)] = i
260 ns_chars.append(c)
261 ns_text = "".join(ns_chars)
262 return (ns_text, ns_to_s_map)
263
264 # We first tokenize `orig_text`, strip whitespace from the result
265 # and `pred_text`, and check if they are the same length. If they are

Callers 1

get_final_textFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected