View source: R/run_classifier.R
| convert_single_example | R Documentation |
InputExample into a single InputFeaturesConverts a single InputExample into a single InputFeatures.
convert_single_example( ex_index, example, label_list, max_seq_length, tokenizer )
ex_index |
Integer; the index of this example. This is used to determine whether or not to print out some log info (for debugging or runtime confirmation). It is assumed this starts with 1 (in R). |
example |
The |
label_list |
Character (or integer); allowed labels for these 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). |
An object of class InputFeatures.
## Not run:
tokenizer <- FullTokenizer("vocab.txt")
input_ex <- InputExample(
guid = 1L,
text_a = "Some text to classify.",
text_b = "More wordy words.",
label = "good"
)
feat <- convert_single_example(
ex_index = 1L,
example = input_ex,
label_list = c("good", "bad"),
max_seq_length = 15L,
tokenizer = tokenizer
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.