ThesaurusManagement | R Documentation |
Functions to modify and check thesauri.
NewThesaurus( caseSensitive = FALSE, accentSensitive = FALSE, punctuationSensitive = FALSE ) AddToThesaurus(thesaurus, newName, category) RemoveRepeatedNames(thesaurus) ThesaurusAmbiguity(thesaurus)
caseSensitive, accentSensitive, punctuationSensitive |
Logical. They set
the case, accent, and punctuation sensitivity ( |
thesaurus |
A thesaurus object. |
newName |
Character vector with new names to be added to the thesaurus. |
category |
Character vector identifying the classes where the new names should be included. |
NewThesaurus
returns an empty thesaurus. This can then be
populated by AddToThesaurus
.
AddToThesaurus
returns the input thesaurus complemented with new
names in the categories identified. If any of the categories is not present
in the input thesaurus, new categories are added as required.
RemoveRepeatedNames
returns the input thesaurus pruned of redundant
names in each category. The redundancy is evaluated in agreement with the
case and accent sensitivity of the thesaurus.
ThesaurusAmbiguity
returns FALSE if no ambiguity is present. When any
ambiguity is found, it returns TRUE with an attribute errmessage
including the names present in more than one category and the
the involved categories. This is internally used by
ReadThesaurus
and AddToThesaurus
to generate an
error in case they attempt to read or generate an ambiguous thesaurus.
zoologThesaurus
for a description of the thesaurus and
thesaurus set structure,
ReadThesaurus
, WriteThesaurus
,
StandardizeNomenclature
## Load an example thesaurus: thesaurus <- ReadThesaurus(system.file("extdata", "taxonThesaurus.csv", package="zoolog")) ## with categories names(thesaurus) # "bos taurus" "ovis aries" "sus domesticus" ## Add names to several categories: thesaurusExtended <- AddToThesaurus(thesaurus, c("Kuh", "Schwein"), c("bos taurus","sus domesticus")) ## This adds the name "Kuh" to the category "bos taurus" and ## the name "Schwein" to the category "sus domesticus". ## Generate a new thesaurus and populate it with two categories ## ("red" and "blue"): thesaurusNew <- NewThesaurus() thesaurusNew <- AddToThesaurus(thesaurusNew, c("scarlet", "vermilion", "ruby", "cherry", "carmine", "wine"), "red") thesaurusNew thesaurusNew <- AddToThesaurus(thesaurusNew, c("sky blue", "azure", "sapphire", "cerulean", "navy", "lapis lazuli", "indigo", "cyan"), "blue") thesaurusNew ## Attempt to generate an ambiguous thesaurus try(AddToThesaurus(thesaurusNew, "scarlet", "blue")) ## Remove repeated names in the same category: thesaurusWithRepetitions <- AddToThesaurus(thesaurusNew, c("scarlet", "ruby"), "red") thesaurusWithRepetitions RemoveRepeatedNames(thesaurusWithRepetitions)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.