Accepts a character string, a path to a text file, or a tibble with a text
column, and returns a tidy one-row-per-sentence tibble ready for scoring.
The language is auto-detected with the cld3 package when available;
otherwise the lang argument is required.
Usage
syn_read_text(x, lang = NULL, text_col = "text", call = rlang::caller_env())Arguments
- x
A single character string, a character vector, a path to an existing
.txtfile, or a tibble/data frame containing a text column.- lang
Language code, one of
"de","en","fr". IfNULL(the default), the language is auto-detected via cld3. If cld3 is not installed andlangisNULL, an error is raised.- text_col
When
xis a tibble, the name of the column holding text.- call
The calling environment, for error reporting. Experts only.
Value
A tibble::tibble() with columns sentence_id (integer),
sentence (character), and lang (character), plus a lang attribute.
Empty input returns a zero-row tibble of the same type.
See also
syn_score() for the next step.
Other reading functions:
syn_example_text()