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 GUI 中这样做),请也提出建议。

4

1 回答 1

3

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

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

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

然后在一个新文件中(我命名为 mine 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”添加到您的默认字典中。

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

于 2020-11-05T04:10:36.550 回答