Description Usage Arguments Details Value Author(s) References Examples
This function computes the stems of each of the given words in the vector. This reduces a word to its base component, making it easier to compare words like win, winning, winner. See http://snowball.tartarus.org/ for more information about the concept and algorithms for stemming.
1 |
words |
a character vector of words whose stems are to be computed. |
language |
the name of a recognized language for the package.
This should either be a single string which is an element in the
vector returned by |
warnTested |
an option to control whether a warning is issued about languages which have not been explicitly tested as part of the unit testing of the code. For the most part, one can ignore these warnings and so they are turned off. In the future, we might consider controlling this with a global option, but for now we suppress the warnings by default. |
This uses Dr. Martin Porter's stemming algorithm and the interface generated by Snowball http://snowball.tartarus.org/.
A character vector with as many elements as there are in the input vector with the corresponding elements being the stem of the word.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
See http://snowball.tartarus.org/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # Simple example
# "win" "win" "winner"
wordStem(c("win", "winning", 'winner'))
# test the supplied vocabulary.
testWords = readLines(system.file("words", "english", "voc.txt", package = "Rstem"))
validate = readLines(system.file("words", "english", "output.txt", package = "Rstem"))
## Not run:
# Read the test words directly from the snowball site over the Web
testWords = readLines(url("http://snowball.tartarus.org/english/voc.txt"))
## End(Not run)
testOut = wordStem(testWords)
all(validate == testOut)
# Specify the language from one of the built-in languages.
testOut = wordStem(testWords, "english")
all(validate == testOut)
# To illustrate using the dynamic lookup of symbols that allows one
# to easily add new languages or create and close environment
# routines (for example, to manage pools if this were an efficiency
# issue!)
testOut = wordStem(testWords, c("testDynCreate", "testDynClose", "testDynStem"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.