applyChanges: Apply a series of sound changes to a series of words.

Description Usage Arguments Details Value See Also Examples

Description

Apply a list of soundchange's to a series of words, possibly with additional metadata, and possibly compare the results to a prediction.

Usage

1
applyChanges(data, changes, source, target, meta, highlight)

Arguments

data

[soundcorrs] A soundcorrs object.

changes

[soundchange] The list of soundchange's to apply.

source

[character] Name of the column containing words to which to apply soundchange's.

target

[character] Name of the column containing words to which to compare the results. Defaults to NULL.

meta

[character] Name of the column containing metadata to be passed to soundchange functions alongside words. Defaults to NULL.

highlight

[character] Highlight the differences between the intermediate forms in $tree, as well as between the results in $end and target? Can be NULL (do not highlight), "console" (highlight for the console), or "HTML" (highlight for a web browser). Defaults to NULL.

Details

Functions in soundchange objects are allowed to return more than one value, which makes manual application of a series of changes highly inconvenient and prone to errors. This function automates the process, while keeping track of all the intermediate forms. It returns the result in three formats: only the final shapes; their comparison to the shapes given under the target argument; and a tree with all the steps along the way. By default, only the final shapes are printed. All the three formats are accessible as elements of a named list: $end, $match, and $tree, respectively.

Note that the application of sound changes does not require the data to be segmented and aligned. If sound changes are the only goal of the project, these two time-consuming steps can be safely omitted.

Value

[list.applyChanges] A list with three fields: $end, a named list with the final results; $match, a named list with one of three values: 0 when none of the final results matches the target, 0.5 when at least one of the final results matches the target, or 1 when all the final results match the target; lastly $tree, a list tracing all the intermediate forms.

See Also

print.list.applyChanges, print.tree.applyChanges

Examples

1
2
3
4
5
6
7
# prepare sample data
dataset <- loadSampleDataset ("data-capitals")
changes <- list (loadSampleDataset("change-dl2l"), loadSampleDataset("change-rhotacism"))
# apply the changes
applyChanges (dataset, changes, "ORTHOGRAPHY.German")
applyChanges (dataset, changes, "ORTHOGRAPHY.German")$tree
applyChanges (dataset, changes, "ORTHOGRAPHY.German", "ORTHOGRAPHY.Polish", highlight="console")

soundcorrs documentation built on Nov. 16, 2020, 5:09 p.m.