replace_contraction: Replace Contractions

Description Usage Arguments Value See Also Examples

View source: R/replace_contraction.R

Description

This function replaces contractions with long form.

Usage

1
2
replace_contraction(text.var, contraction = qdapDictionaries::contractions,
  replace = NULL, ignore.case = TRUE, sent.cap = TRUE)

Arguments

text.var

The text variable.

contraction

A two column key of contractions (column 1) and expanded form replacements (column 2) or a vector of contractions. Default is to use qdapDictionaries's contractions data set.

replace

A vector of expanded form replacements if a data frame is not supplied to the contraction argument.

ignore.case

logical. If TRUE replaces without regard to capitalization.

sent.cap

logical. If TRUE capitalizes the beginning of every sentence.

Value

Returns a vector with contractions replaced.

See Also

bracketX, qprep, replace_abbreviation, replace_number, replace_symbol

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
x <- c("Mr. Jones isn't going.",  
    "Check it out what's going on.",
    "He's here but didn't go.",
    "the robot at t.s. wasn't nice", 
    "he'd like it if i'd go away")

replace_contraction(x)

## End(Not run)

Example output

Loading required package: qdapDictionaries
Loading required package: qdapRegex
Loading required package: qdapTools
Loading required package: RColorBrewer
OpenJDK 64-Bit Server VM warning: Can't detect initial thread stack location - find_vma failed

Attaching package: 'qdap'

The following object is masked from 'package:base':

    Filter

[1] "Mr. Jones is not going."             "Check it out what is going on."     
[3] "He is here but did not go."          "The robot at t.s. was not nice"     
[5] "He would like it if I would go away"
Warning message:
system call failed: Cannot allocate memory 

qdap documentation built on May 15, 2018, 9:04 a.m.