Learn R Programming

koRpus (version 0.06-5)

manage.hyph.pat: Handling hyphenation pattern objects

Description

This function can be used to examine and change hyphenation pattern objects be used with hyphen.

Usage

manage.hyph.pat(hyph.pattern, get = NULL, set = NULL, rm = NULL, word = NULL, min.length = 3, rm.hyph = TRUE)

Arguments

hyph.pattern
Either an object of class kRp.hyph.pat, or a valid language abbreviation for patterns included in this package.
get
A character string, part of a word to look up in the pattern set, i.e., without the numbers indicating split probability.
set
A character string, a full pattern to be added to the pattern set, i.e., including the numbers indicating split probability.
rm
A character string, part of a word to remove from the pattern set, i.e., without the numbers indicating split probability.
word
A character string, a full word to hyphenate using the given pattern set.
min.length
Integer, number of letters a word must have for considering a hyphenation.
rm.hyph
Logical, whether appearing hyphens in words should be removed before pattern matching.

Value

If all action arguments are NULL, returns an object of class kRp.hyph.pat-class. The same is true if set or rm are set and hyph.pattern is itself an object of that class; if you refer to a language instead, pattern changes will be done internally for the running session and take effect immediately. The get argument will return a caracter vector, and word a data frame.

Details

You can only run one of the possible actions at a time. If any of these arguments is not NULL, the corresponding action is done in the following order, and every additional discarded:
  • getSearches the pattern set for a given word part
  • setAdds or replaces a pattern in the set (duplicates are removed)
  • rmRemoves a word part and its pattern from the set
  • wordHyphenates a word and returns all parts examined as well as all matching patterns

If all action arguments are NULL, manage.hyph.pat returns the full pattern object.

References

[1] http://tug.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/txt/

See Also

kRp.hyph.pat-class, hyphen

Examples

Run this code
## Not run: 
# manage.hyph.pat("en", set="r3ticl")
# manage.hyph.pat("en", get="rticl")
# manage.hyph.pat("en", word="article")
# manage.hyph.pat("en", rm="rticl")
# ## End(Not run)

Run the code above in your browser using DataLab