Description Usage Arguments Details Value See Also Examples
Apply a list of soundchange
's to a series of words, possibly with additional metadata, and possibly compare the results to a prediction.
1 | applyChanges(data, changes, source, target, meta, highlight)
|
data |
[soundcorrs] A |
changes |
[soundchange] The list of |
source |
[character] Name of the column containing words to which to apply |
target |
[character] Name of the column containing words to which to compare the results. Defaults to |
meta |
[character] Name of the column containing metadata to be passed to |
highlight |
[character] Highlight the differences between the intermediate forms in |
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.
[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.
print.list.applyChanges
, print.tree.applyChanges
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.