Skip to contents

Based on a character vectors and up to three label arguments, create an object where those arguments are attributes. These are:

  • source: Where the text comes from. This will be printed in the first line of the example, without word alignment.

  • translation: Free translation. This will be printed as the last line of the example, without word alignment and in quotation marks if so desired.

  • label: Named label of the example, for cross-references.

  • lengths: This is computed within the function, not provider, and it's the number of items identified in each gloss line.

Usage

as_gloss(
  ...,
  source = NULL,
  translation = NULL,
  label = NULL,
  trans_quotes = config$trans_quotes,
  output_format = config$output,
  numbering = config$numbering
)

Arguments

...

Lines for glossing

source

(Optional) Source of example

translation

(Optional) Free translation

label

(Optional) Example label

trans_quotes

(Optional) Quotes to surround the free translation with.

output_format

(Optional) Whether it will use latex, word or html format.

numbering

(Optional) Whether the gloss should be numbered (in Word and HTML).

Value

Object of class gloss, ready to be printed based on the chosen output format, and with a gloss_data object as data attribute (or, in the case of calls via gloss_df(), the original input asdata).

Examples

ex_sp <- "Un ejemplo en español"
ex_gloss <- "DET.M.SG example in Spanish"
ex_trans <- "An example in Spanish"
my_gloss <- as_gloss(ex_sp, ex_gloss, translation = ex_trans, label="ex1")

# check the gloss data
attr(my_gloss, "data")
#> [1] "Un ejemplo en español"       "DET.M.SG example in Spanish"
#> attr(,"has_source")
#> [1] FALSE
#> attr(,"source")
#> [1] ""
#> attr(,"has_translation")
#> [1] TRUE
#> attr(,"translation")
#> [1] "\"An example in Spanish\""
#> attr(,"label")
#> [1] "ex1"
#> attr(,"lengths")
#> [1] 4 4
#> attr(,"class")
#> [1] "gloss_data" "character"