getDiffTexts: The getDiffTexts function

Description Usage Arguments Warnings Examples

View source: R/getDiffTexts.R

Description

Return the indexes of common and different elements of two texts.

Usage

1
getDiffTexts(a.text, b.text, sep = " ")

Arguments

a.text,

a string to compare.

b.text,

another string to compare.

sep,

short string containing separator. We will use this string to split texts into smaller pieces. " " would split texts into words and "\." would split texts into sentences.

Warnings

geDiffTexts uses LCS algortihm to compute differences between two texts. If texts are considerably long be aware that this implementation of LCS is O(n^2) expensive, both time and memory wise, so it is recommended to use sep = "\." to speed up the execution.

Examples

1
2
3
text.1 <- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nec vehicula purus. Praesent vehicula risus a purus sollicitudin cursus. Nullam hendrerit efficitur gravida. Sed ut quam a urna sollicitudin dapibus. Integer vitae ultricies sapien, eu tincidunt lacus. Suspendisse eget dapibus diam."
text.2 <- "Nullam hendrerit efficitur gravida. Sed ut quam a urna sollicitudin dapibus. Integer vitae ultricies sapien, eu tincidunt lacus. Pellentesque sed dui turpis."
getDiffTexts(text.1, text.2)

neperiana/wikiHistoRyViz documentation built on Nov. 4, 2019, 9:31 p.m.