MCPcopy
hub / github.com/appvision-ai/fast-bert / _create_examples

Method _create_examples

fast_bert/data_cls.py:282–303  ·  view source on GitHub ↗

Creates examples for the training and dev sets.

(self, df, set_type, text_col, label_col)

Source from the content-addressed store, hash-verified

280 return self.labels
281
282 def _create_examples(self, df, set_type, text_col, label_col):
283 """Creates examples for the training and dev sets."""
284 if label_col is None:
285 return list(
286 df.apply(
287 lambda row: InputExample(
288 guid=row.index, text_a=str(row[text_col]), label=None
289 ),
290 axis=1,
291 )
292 )
293 else:
294 return list(
295 df.apply(
296 lambda row: InputExample(
297 guid=row.index,
298 text_a=str(row[text_col]),
299 label=str(row[label_col]),
300 ),
301 axis=1,
302 )
303 )
304
305
306class MultiLabelTextProcessor(TextProcessor):

Callers 3

get_train_examplesMethod · 0.95
get_dev_examplesMethod · 0.95
get_test_examplesMethod · 0.95

Calls 1

InputExampleClass · 0.70

Tested by

no test coverage detected