MCPcopy Create free account
hub / github.com/apple/axlearn / test_split_sentences

Method test_split_sentences

axlearn/common/input_text_test.py:331–349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

329 """Tests split_sentences."""
330
331 def test_split_sentences(self):
332 texts = [
333 "this is a pretty long sentence\n",
334 "this is sentence one.\n\n\nthis is sentence two. three.",
335 ]
336 ds_fn = make_ds_fn(False, texts, repeat=1)
337 split_fn = input_text.split_sentences()
338 ds = split_fn(ds_fn())
339
340 expected = [
341 "this is a pretty long sentence",
342 "",
343 "this is sentence one.",
344 "this is sentence two.",
345 "three.",
346 "",
347 ]
348 actual = [extract_text(x) for x in ds]
349 assert expected == actual
350
351 def test_split_sentences_keys(self):
352 texts = [

Callers

nothing calls this directly

Calls 3

make_ds_fnFunction · 0.90
extract_textFunction · 0.90
ds_fnFunction · 0.70

Tested by

no test coverage detected