如何向已有的Aspell词典中添加更多单词?

3
我已安装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图形用户界面进行操作),也请提供建议。

你在编辑器中输入代码时,实际上正在进行拼写检查吗?还是使用一个使用Aspell字典的软件包?我试图弄清楚这与R有什么关系。 - MrFlick
此外,同一天在不同的堆栈交换网站上发布相同的帖子是不礼貌的。http://superuser.com/questions/768498/how-do-i-add-more-words-to-an-existing-aspell-dictionary - MrFlick
@MrFlick 我正在使用R中的一个包,它使用Aspell字典。 - user3710832
1个回答

3

我知道这个帖子很老,而且它是关于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"添加到您的默认字典中。

我知道这个帖子早已过时,但认为这可能会有用!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接