ReplaceByList: Replace a list of words by another

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/ReplaceByList.R

Description

Optimized replacement of words inside a text corpus.

Usage

1
ReplaceByList(corpus, wordsFile)

Arguments

corpus

a VCorpus or Corpus object.

wordsFile

a TXT file (two columns separated by tab). One column containing the final word to be in the corpus and a second, containing the word to replace. Example: clustering cluster_analysis clustering cluster

Details

This function is provided as a replacing words step in a corpus composition process, this list must have a .txt file extension made by two columns, one for words of replacement and other for words to be replaced.

Value

An object inheriting from VCorpus and Corpus.

Author(s)

Camila Gongora mcgongoraa@unal.edu.co, Andres Palacios anfpalacioscl@unal.edu.co

See Also

See also BibToCorpus where this function is used internally.

Examples

1
2
3
4
5
6
data("KDVizData")
wordsToReplace <- system.file("extdata", "KDReplaceWords.txt", package = "KDViz")
myCorpus <- BibToCorpus(bibData = KDVizData, bibUnits = "Keywords",
  controlList = c("stripWhitespace", "removeNumbers"), stopWords = TRUE)

myNewCorpus <- ReplaceByList(myCorpus, wordsFile = wordsToReplace)

KDViz documentation built on May 1, 2019, 6:34 p.m.

Related to ReplaceByList in KDViz...