Learn R Programming

RBERT (version 0.1.11)

convert_examples_to_features: 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

Run this code
# 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
)
# }

Run the code above in your browser using DataLab