2

Raspellで package の関数を使用して、テキストのスペル チェックを行っています。utilsまた、Aspell によって検出された間違った単語の正しい単語を抽出しようとしています。しかし、Aspell はいくつかの間違った単語に対して攻撃的な単語を提案しています。私はそれを望んでいません。Aspell がこれを行わないようにするにはどうすればよいですか? R のみを使用して Aspell 辞書から特定の単語を削除する方法はありますか? これが私が Aspell を使用している方法です。

spelling_mistakes <- aspell(file_location2,"Rd", control = c("--master=en_US"),
                            program = aspell_location)

incorrect_words_list <- spelling_mistakes[, 1]

correct_words_for_incorrect_words <- spelling_mistakes[, 5]
4

1 に答える 1

2

どうですか:

badWords <- scan(url("http://www.bannedwordlist.com/lists/swearWords.txt"),
                 what=character(0))
## note that the 'bad' words include "job", and "hit" ... 
clean_words <- setdiff(spelling_mistakes[,5],badWords)

あなたは再現可能な例を与えていないので、私はこれをテストしていません...

これは代替案を提供しないことに注意してください。しかし、それはあなたを途中まで連れて行きます。のドキュメントでaspellは、代替辞書を使用できることが示唆されていますが、自分で読むこともできます... http://wordlist.aspell.net/other-dicts/

http://lists.gnu.org/archive/html/aspell-user/2007-07/msg00004.htmlも参照してください。

于 2014-06-17T12:47:45.900 に答える