r - 如何向现有的 Aspell 词典中添加更多单词?

我已经安装了 Aspell 字典来拼写检查我的文档。但是在文档中有一些拼写错误的单词,但我不希望 aspell 检测到这些单词是错误的。所以,基本上我想将这些词添加到现有的 aspell 词典中。

我正在尝试按照此处给出的说明进行操作:http://wiki.zimbra.com/wiki/Adding_words_to_existing_aspell_dictionaries但我无法理解此处给出的命令以及在何处键入这些命令。我尝试在命令提示符下执行这些命令,但我不断收到有关目录的错误。这就是我在命令提示符下尝试的内容。

我的Aspell程序的路径是C:/Program Files (x86)/Aspell/

C:\Program Files (x86)>/Aspell/bin/./aspell --lang=en create master yourl
ist.rws < C:/Users/admin/Desktop/yourlist.txt
The system cannot find the path specified.

C:\Program Files (x86)>

请告诉我我做错了什么?我以前没有在命令提示符下工作过。

此外,如果有任何其他更简单的替代方案(例如从 R GUI 这样做),也请提出建议。

最佳答案

我知道这个帖子很旧,而且它是关于 Windows 的,但我在让它在 Linux 上运行时遇到了问题,这个帖子是唯一出现的搜索结果之一,但没有答案。因此,虽然这不能回答确切的问题,但我编写了一个脚本,允许您将单词添加到字典中,希望对某些人有所帮助。

首先,运行以下命令以确定您的默认字典名称是什么:

$ aspell dump config | grep "default: <lang>"

然后在一个新文件中(我命名为addword):

#!/bin/bash

# This should be whatever your path to your aspell directory is
ASPELL_DIR=/usr/lib/aspell-0.60
# Make sure to change this to the proper dictionary name
ENGLISH_DICT="$ASPELL_DIR/<your-default-dictionary>.multi"
# And name this to the filename you want for your dictionary
MY_DICT_NAME="my-dict"
# then the directory path to that file
MY_DICT_SRC="/path/to/dict/$MY_DICT_NAME.txt"
MY_DICT_DEST="$ASPELL_DIR/$MY_DICT_NAME.rws"

if [ "$EUID" -ne 0 ]; then
    echo "You must execute this script as root."
    exit -1;
fi

if [ $# -eq 0 ]; then
    echo "No arguments supplied"
else
    if ! grep -q "$MY_DICT_NAME.rws" "$ENGLISH_DICT" ; then
        echo "add $MY_DICT_NAME.rws" >> "$ENGLISH_DICT"
        echo "Adding $MY_DICT_DEST to $ENGLISH_DICT"
    fi

    echo "$1" >> "$MY_DICT_SRC"
    echo "Adding '$1' to English dictionary $MY_DICT_SRC"

    sudo aspell --lang=en create master "$MY_DICT_DEST" < "$MY_DICT_SRC"
fi

然后运行

sudo addword aragorn

会将单词“aragorn”添加到您的默认词典中。

我知道这个帖子早就死了,但我认为这可能有用!

https://stackoverflow.com/questions/24210480/

相关文章:

r - 按第一列对矩阵列表进行排序

c# - C# 对象中 [key] 的用途是什么?

sorting - thenComparing 与 thenComparingInt 的性能 - 使

python - Tkinter Windows 按键事件

r - 为什么 R 的 ccf 说 "Autocorrelations of series ' X'

ports - 代理服务器的推荐端口

visual-c++ - 带颜色的进度条和带有通用控件的边框

ruby-on-rails - 不知道如何构建任务 - cucumber

wordpress - 如何使用非拉丁 url 在 iis 上为 wordpress 编写 web.

hibernate - 在 JPA 中同时映射键和对象