Skip to contents

Converts a qlm_translate() result, or a text column of a qlm_coded object, to a quanteda corpus. Quanteda is optional and is needed only when calling its corpus() generic.

Usage

corpus.qlm_coded(x, text_field = NULL, ...)

corpus.qlm_translation(x, ...)

Arguments

x

A qlm_translation or a qlm_coded object.

text_field

For a qlm_coded object, the name of the character column to use as corpus texts. It can be omitted only when there is exactly one character output column.

...

Reserved; must be empty.

Value

A quanteda corpus with the translation names, or .id, as document names. If the texts came from a corpus, its docvars and system and user metadata are restored, and text summary caches are cleared. Translation provenance is stored in meta$user$quallmer$translation. For a coded object, the other output columns, coding metadata and codebook are stored in meta$user$quallmer$coding.

Examples

if (FALSE) { # \dontrun{
translated <- qlm_translate(c(a = "Bonjour"), "deepl/quality_optimized")
quanteda::corpus(translated)

summaries <- qlm_code(translated, my_summary_codebook, model = "openai/gpt-4o-mini")
quanteda::corpus(summaries, text_field = "summary")
} # }