R: Combine labels and text as used in fasttext

as_fasttext {udpipe} | R Documentation

## Combine labels and text as used in fasttext

### Description

Fasttext prepends a label or different labels to text using a special string (__label__). This function takes a character vector of text and prepends the labels alongside the special string.

### Usage

    as_fasttext(x, y, label = "__label__")

### Arguments

`x` | a character vector
`y` | a character vector of labels or a list of labels. `y` should be of the same length as `x`
`label` | the string to use to prepend to the label. Defaults to __label__

### Value

a character vector of text where `x` and `y` are combined

### Examples

    as_fasttext(x = c("just a bit of txt", "example2", "more txt please", "more"),
                y = c("pos", "neg", "neg", NA))
    as_fasttext(x = c("just a bit of txt", "example2", "more txt please", "more"),
                y = list(c("ok", "pos"), c("neg", "topic2"), "", NA))

[Package udpipe version 0.8.8 Index]