【问题标题】:How do I add more words to an existing Aspell dictionary?如何向现有的 Aspell 词典添加更多单词?
【发布时间】:2020-11-05 12:10:36
【问题描述】:

我已经安装了 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 中这样做),请也提出建议。

【问题讨论】:

  • 您在编辑器中输入代码时是否真的在拼写检查?或者你正在使用一个使用 Aspell 字典的包?我试图弄清楚这与 R 有什么关系。
  • 另外,在同一天交叉发布到不同的堆栈交换站点是不礼貌的superuser.com/questions/768498/…
  • @MrFlick 我在 R 中使用了一个使用 Aspell 字典的包。

标签: r cmd aspell


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 2015-08-17
    • 1970-01-01
    • 2017-01-20
    • 1970-01-01
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-06-18
    • 1970-01-01
    相关资源
    最近更新 更多