natlan: Translate DELTA-format data into natural language...

View source: R/natlan.R

natlanR Documentation

Translate DELTA-format data into natural language descriptions via CONFOR

Description

This function replicates the TRANSLATE INTO NATURAL LANGUAGE command in the DELTA system. It creates the necessary directives file and runs the CONFOR program to generate natural language descriptions.

Usage

natlan(
  delta,
  heading = NULL,
  replace_angle_brackets = TRUE,
  omit_character_numbers = TRUE,
  omit_inapplicables = TRUE,
  omit_comments = TRUE,
  omit_inner_comments = TRUE,
  omit_final_comma = TRUE,
  translate_implicit_values = FALSE,
  omit_lower_for_characters = NULL,
  omit_or_for_characters = NULL,
  omit_period_for_characters = NULL,
  new_paragraphs_at_characters = NULL,
  item_subheadings = NULL,
  link_characters = NULL,
  replace_semicolon_by_comma = NULL,
  print_width = 80,
  exclude_items = NULL,
  exclude_characters = NULL,
  vocabulary = NULL,
  remove_temp = TRUE
)

Arguments

delta

A Delta dataset object (created by load_delta)

heading

Heading for the descriptions (default = NULL, uses heading from specs file)

replace_angle_brackets

Replace angle brackets with parentheses (default = TRUE)

omit_character_numbers

Omit character numbers from descriptions (default = TRUE)

omit_inapplicables

Omit 'or not applicable' from descriptions (default = TRUE)

omit_comments

Omit comments in attributes (default = TRUE)

omit_inner_comments

Omit inner comments in character list and attributes (default = TRUE)

omit_final_comma

Omit final comma before 'and' (default = TRUE)

translate_implicit_values

Output implicit values in descriptions (default = FALSE)

omit_lower_for_characters

List of numeric characters to omit lower values

omit_or_for_characters

List of characters to omit 'or' between alternatives

omit_period_for_characters

List of characters where period would normally terminate a sentence

new_paragraphs_at_characters

List of characters where new paragraphs should start

item_subheadings

List of subheadings for items (delimiter/character/value)

link_characters

List of characters specifying how attributes are combined

replace_semicolon_by_comma

List of characters to use comma instead of semicolon

print_width

Maximum line length for output (default = 80)

exclude_items

List of items to exclude

exclude_characters

List of characters to exclude

vocabulary

List for custom vocabulary (default = NULL)

remove_temp

Logical; if TRUE, remove temporary files after conversion (default = TRUE)

Details

The function assumes that the CONFOR program executable is available in the system PATH or in the current working directory.

Value

Invisibly returns the descriptions as a character vector

Examples

# Requires the CONFOR executable on the PATH.

try({
  delta <- load_delta(
    system.file("extdata", "chars_viola", package = "RDelta"),
    system.file("extdata", "items_viola", package = "RDelta"),
    system.file("extdata", "specs_viola", package = "RDelta")
  )
  natlan(delta)
  natlan(delta,
         heading = "Flora of Region X - species descriptions",
         item_subheadings = list(
           "87" = "Transverse section of lamina",
           "96" = "Leaf epidermis"
         ))
})


RDelta documentation built on Oct. 28, 2026, 5:12 p.m.