mark_word_stems: Mark Words Containing Stems With Class for Highlighting

Description Usage Arguments Value See Also Examples

Description

Mark words containing stems with a class for highlighting.

Usage

1
mark_word_stems(x, stems, marks_class, ignore.case = TRUE, ...)

Arguments

x

A character vector with stems to operate on.

stems

The word stems to search for.

marks_class

The classes to apply to word (must be equal to stems in length). These are dictated by the css generated for marks in highlight_template.

ignore.case

logical. If TRUE case is ignored.

...

Other arguments passed to gsub.

Value

Returns a character vector with mark tags added around words that contain the stems.

See Also

Other mark.functions: mark_regex, mark_sentences, mark_words

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x <-"I like good cheeses but she hated Bad cheese."
stems <- c("cheese", "like", "good", "bad")
marks_class <- c("neutral", "pos", "pos", "neg")
marks <- c(pos = "lightgreen", neg = "pink", neutral = "yellow")

(body <- mark_word_stems(x, stems, marks_class))
## Not run: 
## To an external file
template2html(insert_body(highlight_template(marks), body))
open_html()

## End(Not run)

trinker/hilight documentation built on May 31, 2019, 8:51 p.m.