ThesaurusManagement | R Documentation |
Functions to modify and check thesauri.
NewThesaurus( caseSensitive = FALSE, accentSensitive = FALSE, punctuationSensitive = FALSE ) AddToThesaurus(thesaurus, newName, category = NULL) RemoveRepeatedNames(thesaurus) ThesaurusAmbiguity(thesaurus)
caseSensitive, accentSensitive, punctuationSensitive |
Logical. They set
the case, accent, and punctuation sensitivity ( |
thesaurus |
A thesaurus object. |
newName |
Character vector or (named) list of character vectors with new names to be added to the thesaurus. |
category |
Character vector identifying the classes where the new names should be included. |
In the function AddToThesaurus
the categories in which to add new
names can be specified either as names of a named list given as argument
newName
or explicitly in the argument category
. See the
examples below illustrating both alternatives.
From version 1.2.0 AddToThesurus
directly removes repeated names in
the resulting thesaurus.
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"), "blue") thesaurusNew ## Categories and names can also be included as named list thesaurusNew <- AddToThesaurus(thesaurusNew, list( blue = c("lapis lazuli", "indigo", "cyan"), brown = c("hazel", "chocolate-coloured", "brunette", "mousy", "beige")) ) thesaurusNew ## Attempt to generate an ambiguous thesaurus try(AddToThesaurus(thesaurusNew, "scarlet", "blue")) ## From version 1.2.0 AddToThesurus directly removes repeated names: AddToThesaurus(thesaurusNew, c("scarlet", "ruby"), "red") ## Remove repeated names in the same category: ## If we included any repetitions thesaurusNew[8:9,1] <- c("scarlet", "ruby") thesaurusNew ## they can be removed with RemoveRepeatedNames(thesaurusNew)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.