README.md

RSpellCorrection

Spell Corrector, an R Wrapper on the Scala implementation. This is a wrapper for another project, SpellCorrection, written in Scala. It is an implementation of Peter Norvig's spell corrector (his article). For the corrector to work, download a corpus, such as big.txt by Norvig.

This repository is also a demo for my blog entry: rJava: Running Java from R, and Building R Packages Wrapping a .jar.

Installation

To install it, please make sure you have the devtools package installed. If not, enter, in your R console,

install.packages('devtools')

Then load the package, and run the installation:

library(devtools)
install_github('stephenhky/RSpellCorrection')

Example

Load the package by entering

library(RSpellCorrection)

Create a Java instance for the spell corrector by entering:

corrector <- getcorrector(filepath='path/to/big.txt')

Then do the spell correction by:

correct('boook', corrector)   # output 'book'
correct('statistiscs', corrector)    # output 'statistics'

Reference



stephenhky/RSpellCorrection documentation built on May 30, 2019, 3:19 p.m.