convert_examples_to_features: Convert 'InputExample's to 'InputFeatures'

View source: R/run_classifier.R

convert_examples_to_featuresR Documentation

Convert InputExamples to InputFeatures

Description

Converts a set of InputExamples to a list of InputFeatures.

Usage

convert_examples_to_features(examples, label_list, max_seq_length, tokenizer)

Arguments

examples

List of InputExamples to convert.

label_list

Character (or integer?); possible labels for examples.

max_seq_length

Integer; the maximum number of tokens that will be considered together.

tokenizer

A tokenizer object to use (e.g. object of class FullTokenizer).

Value

A list of InputFeatures.

Examples

## Not run: 
tokenizer <- FullTokenizer("vocab.txt")
input_ex1 <- InputExample(
  guid = 1L,
  text_a = "Some text to classify.",
  text_b = "More wordy words.",
  label = "good"
)
input_ex2 <- InputExample(
  guid = 2L,
  text_a = "This is another example.",
  text_b = "So many words.",
  label = "bad"
)
feat <- convert_examples_to_features(
  examples = list(input_ex1, input_ex2),
  label_list = c("good", "bad"),
  max_seq_length = 15L,
  tokenizer = tokenizer
)

## End(Not run)

jonathanbratt/RBERT documentation built on Jan. 26, 2023, 4:15 p.m.