correct.hyph {sylly} | R Documentation |
Correct kRp.hyphen objects
Description
The method correct.hyph
can be used to alter objects of class kRp.hyphen
.
Usage
correct.hyph(obj, word = NULL, hyphen = NULL, cache = TRUE)
## S4 method for signature 'kRp.hyphen'
correct.hyph(obj, word = NULL, hyphen = NULL, cache = TRUE)
Arguments
obj |
An object of class |
word |
A character string,
the (possibly incorrectly hyphenated) |
hyphen |
A character string,
the new manually hyphenated version of |
cache |
Logical, if |
Details
Although hyphenation should turn out to be rather accurate, the algorithm does ususally produce some errors. If you want to correct for these flaws, this method can be of help, because it might prevent you from introducing new errors. That is, it will do some sanitiy checks before the object is actually manipulated and returned.
That is,
correct.hyph
checks whether word
and hyphen
are actually hyphenations of the
same token before proceeding. If so,
it will also recalculate the number of syllables and update the syll
field.
If both word
and hyphen
are NULL
,
correct.hyph
will try to simply recalculate the syllable count
for each word,
by counting the hyphenation marks (and adding 1 to the number). This can be usefull if you changed hyphenation
some other way, e.g. in a spreadsheet GUI,
but don't want to have to correct the syllable count yourself as well.
Value
An object of the same class as obj
.
Examples
## Not run:
hyphenated.txt <- correct.hyph(hyphenated.txt, "Hilfe", "Hil-fe")
## End(Not run)