Discussion:
[Aspell-user] How to create and use an additional word list ?
Timothy Madden
2011-09-20 13:20:36 UTC
Permalink
Hello

I would like to spell check my document from the command line. My .tex
document contains a macro (namely \write18 {cmd...}) that can run a
shell command when the document is being processed by LaTeX, and I would
like to invoke aspell in this way to ensure my document checks
successfully every time I compile it.

The problem is I have certain words that are correct and I would like
aspell to recognize (or ignore) them. These are either technical words
like runtime or acronims like XASL or people or product names.

So I would like to create an aditional word list with these specific
words, without installing it as a new dictionary in one of the known
aspell dictionaries or word list directories.

The
aspell --lang=en create master ./documentlist.multi <./list_file

command works pretty well and I can see the words in the list if I open
the ./documentlist.multi file with an editor (I use vim) directly.

The problem is how do use this file ?
If I try the simple command
aspell dump personal ./documentlist.multi
I get
Unhandled Error: The file "./documentlist.multi" is not in the proper
format.
Aborted (core dumped).

Any other way to use the generated file either crashes in the same way,
either does not make use of the file

For example the command
aspell --add-word-list-path=./ --add-extra-dicts=documentlist dump dicts
does not show the new word list.

The command
aspell --lang=en --personal=./documentlist.multi docfile.tex
Just outputs "The file ./documentlist.multi is not in the proper format".

If I try
aspell --add-word-list-path=./ --personal=documentlist check docfile.tex
than aspell starts up but does not use the words in my word list and
asks me to correct them when encountered in the document

Is this a bug ?
Is there a way to use aspell with an additional local dictionary ?

Also, what is the proper way to check a document non-interactively from
the command line ?

$ aspell --version
@<#> International Ispell Version 3.1.20 (but really Aspell 0.60.5)

Thank you,
Timothy Madden
Kevin Atkinson
2011-09-21 19:30:10 UTC
Permalink
On Tue, 20 Sep 2011, Timothy Madden wrote:

Hi,

I'm afraid you are getting several concepts confused, more below.
Post by Timothy Madden
I would like to spell check my document from the command line. My .tex
document contains a macro (namely \write18 {cmd...}) that can run a shell
command when the document is being processed by LaTeX, and I would like to
invoke aspell in this way to ensure my document checks successfully every
time I compile it.
The problem is I have certain words that are correct and I would like aspell
to recognize (or ignore) them. These are either technical words like runtime
or acronims like XASL or people or product names.
So I would like to create an aditional word list with these specific words,
without installing it as a new dictionary in one of the known aspell
dictionaries or word list directories.
The
aspell --lang=en create master ./documentlist.multi <./list_file
Note you are creating a compiled or "master" dictionary. Also note, the
normal extension in ".rws", and the ".multi" points to, perhapses multiple,
".rws" files. Although you might be able to get away with abusing the
extension.
Post by Timothy Madden
command works pretty well and I can see the words in the list if I open the
./documentlist.multi file with an editor (I use vim) directly.
The problem is how do use this file ?
If I try the simple command
aspell dump personal ./documentlist.multi
I get
Unhandled Error: The file "./documentlist.multi" is not in the proper format.
Correct, you created a "master" dictionary not a personal one.

Try "dump master".
Post by Timothy Madden
For example the command
aspell --add-word-list-path=./ --add-extra-dicts=documentlist dump dicts
does not show the new word list.
"dump dicts" lists the available dictionaries, not the one used. It may be
that that "dump dicts" is not taking it into account, word-list-path, or
it may also be that since your dictionary does not follow the standard
naming conventions it is ignoring it.

Anyway its not likely doing what you expected.
Post by Timothy Madden
The command
aspell --lang=en --personal=./documentlist.multi docfile.tex
Just outputs "The file ./documentlist.multi is not in the proper format".
Correct, its not a personal dictionary.
Post by Timothy Madden
If I try
aspell --add-word-list-path=./ --personal=documentlist check docfile.tex
than aspell starts up but does not use the words in my word list and asks me
to correct them when encountered in the document
Try
aspell --add-extra-dicts=./documentlist check docfile.tex

If that doesn't work, try renaming documentlist.multi to documentlist.rws
and try again with
aspell --add-extra-dicts=./documentlist.rws check docfile.tex
Post by Timothy Madden
Is there a way to use aspell with an additional local dictionary ?
If you use the right commands, file extensions, etc. It should work.
Post by Timothy Madden
Also, what is the proper way to check a document non-interactively from the
command line ?
What are you looking for? A list of misspelled words, in that case use
"aspell list"
Timothy Madden
2011-09-23 12:35:10 UTC
Permalink
On 21.09.2011 22:30, Kevin Atkinson wrote:
[...]
Post by Kevin Atkinson
Post by Timothy Madden
If I try
aspell --add-word-list-path=./ --personal=documentlist check docfile.tex
than aspell starts up but does not use the words in my word list and
asks me to correct them when encountered in the document
Try
aspell --add-extra-dicts=./documentlist check docfile.tex
If that doesn't work, try renaming documentlist.multi to
documentlist.rws and try again with
aspell --add-extra-dicts=./documentlist.rws check docfile.tex
Post by Timothy Madden
Is there a way to use aspell with an additional local dictionary ?
If you use the right commands, file extensions, etc. It should work.
Post by Timothy Madden
Also, what is the proper way to check a document non-interactively
from the command line ?
What are you looking for? A list of misspelled words, in that case use
"aspell list"
Thank you ! It worked now.

Using --add-extra-dicts=./documentlist.rws worked well, and indeed
"list" is indeed what I needed, except that I find it a little strange
to take its input document from the standard input instead of a file
name parameter, so it also needs an explicit --mode=tex argument on the
command line, since reading text from standard input now means the
command can no longer see the file name extension (.tex) to get the
default mode.

Now I have the problem that I do not know how to add a tex-command on
the command line to aspell list. As embedded in my .tex document, my
current command to check my text is:

\write 18
{
aspell
--encoding=utf-8
--lang=en
--add-extra-dicts=./\currfilebase.rws
--mode=tex
--add-tex-command="autoref p"
--add-tex-command="nameref p"
--add-tex-command="url p"
--add-tex-command="href opP"
--add-tex-command="hyperdef ppP"
--add-tex-command="write pp"
list<\currfilepath
}

However something is wrong with the arguments because the arguments to
all those LaTeX commands (autoref, nameref, url, href, hyperdef, write)
are still being output by aspell list as being misspelled words.

What is the proper way to add a new TeX command on the aspell command line ?

Thank you,
Timothy Madden
Kevin Atkinson
2011-09-23 17:27:18 UTC
Permalink
Now I have the problem that I do not know how to add a tex-command on the
command line to aspell list. As embedded in my .tex document, my current
\write 18
{
aspell
--encoding=utf-8
--lang=en
--add-extra-dicts=./\currfilebase.rws
--mode=tex
--add-tex-command="autoref p"
--add-tex-command="nameref p"
--add-tex-command="url p"
--add-tex-command="href opP"
--add-tex-command="hyperdef ppP"
--add-tex-command="write pp"
list<\currfilepath
}
However something is wrong with the arguments because the arguments to all
those LaTeX commands (autoref, nameref, url, href, hyperdef, write) are still
being output by aspell list as being misspelled words.
What is the proper way to add a new TeX command on the aspell command line ?
What you have should work. I suggest you try it manually to isolate the
problem. When I spot checked it, things seamed to work.
Timothy Madden
2011-09-26 12:54:43 UTC
Permalink
Post by Timothy Madden
Now I have the problem that I do not know how to add a tex-command on
the command line to aspell list. As embedded in my .tex document, my
\write 18
{
aspell
--encoding=utf-8
--lang=en
--add-extra-dicts=./\currfilebase.rws
--mode=tex
--add-tex-command="autoref p"
--add-tex-command="nameref p"
--add-tex-command="url p"
--add-tex-command="href opP"
--add-tex-command="hyperdef ppP"
--add-tex-command="write pp"
list<\currfilepath
}
However something is wrong with the arguments because the arguments to
all those LaTeX commands (autoref, nameref, url, href, hyperdef,
write) are still being output by aspell list as being misspelled words.
What is the proper way to add a new TeX command on the aspell command line ?
What you have should work. I suggest you try it manually to isolate the
problem. When I spot checked it, things seamed to work.
Indeed it seems to work for the most part, the problems are:
- blocks within an argument
- the \write18 TeX primitive

For the first case, if I have --add-tex-command="href opP" (which means
the first 2 arguments to \href should not be checked) and the following
text:

\href [pdfstartview={FitH 0}] {./file.html} {Link Text}

than it follows that `[pdfstartview={FitH 0}]` should not be checked.
However I find that aspell still checks the block inside it, {FitH 0}.
This may be desirable in some situations, but as this example shows, it
can also be a problem in others.

Can this please be avoided ?

For the second case, \write18, in TeX a number terminates the name of a
backslash command, so when I say \write18, what I really say is \write
18. That is the `\write` command, with the (first) argument `18`. The
`\write` primitive in TeX has two arguments:
- the write number, which is actually the file descriptor number
- the string to be written to the given file.

However in the case of file descriptor 18, the descriptor is not an
actual file, but a command line interpreter. That is, any data written
to it in the normal way starts the command interpreter to to carry out
the data as a command.

So \write18 {cmd ...} is actually \write 18 {cmd...}

The problem is that in either form aspell can not understand it as such,
and with any of --add-tex-command="write pp" or
--add-tex-command="write18 p", aspell wants to spell check {cmd ...}
either way.

The next step would be to try `\write {18} {cmd ...}` and see what
aspell can do. Such a form however is not accepted by TeX, which
complains that {18} is not a number. The only way to get it working was
\newcommand {\shellcmd} [1] {\write 18 {#1}}
The macro in turn may some implications related to LaTeX command
expansion, if for example the {cmd ...} has some brace '}' or pipes '|'
characters in the command line.

Is there some way to make aspell understand `\write 18 {cmd ...}` ? Can
this be fixed ? Or can this case be documented in the tex mode/filter
page in the documentation ?

Thank you,
Timothy Madden
Kevin Atkinson
2011-09-27 01:08:36 UTC
Permalink
Hi, I consider the first problem (\href [pdfstartview={FitH 0}] ..) a bug,
and the second (\write 18) a limitation of the current filter. If you
have the time please file a bug report and feature request for the two
problems so that I don't forget about them.

If you are willing to compile from source you might want to check out this
patch from Matthias Franz:
https://lists.gnu.org/archive/html/aspell-devel/2011-02/msg00000.html

I hope to incorporate his changes somehow in Aspell 0.60.7.
Post by Timothy Madden
Post by Timothy Madden
Now I have the problem that I do not know how to add a tex-command on
the command line to aspell list. As embedded in my .tex document, my
\write 18
{
aspell
--encoding=utf-8
--lang=en
--add-extra-dicts=./\currfilebase.rws
--mode=tex
--add-tex-command="autoref p"
--add-tex-command="nameref p"
--add-tex-command="url p"
--add-tex-command="href opP"
--add-tex-command="hyperdef ppP"
--add-tex-command="write pp"
list<\currfilepath
}
However something is wrong with the arguments because the arguments to
all those LaTeX commands (autoref, nameref, url, href, hyperdef,
write) are still being output by aspell list as being misspelled words.
What is the proper way to add a new TeX command on the aspell command line ?
What you have should work. I suggest you try it manually to isolate the
problem. When I spot checked it, things seamed to work.
- blocks within an argument
- the \write18 TeX primitive
For the first case, if I have --add-tex-command="href opP" (which means the
\href [pdfstartview={FitH 0}] {./file.html} {Link Text}
than it follows that `[pdfstartview={FitH 0}]` should not be checked. However
I find that aspell still checks the block inside it, {FitH 0}. This may be
desirable in some situations, but as this example shows, it can also be a
problem in others.
Can this please be avoided ?
For the second case, \write18, in TeX a number terminates the name of a
backslash command, so when I say \write18, what I really say is \write 18.
That is the `\write` command, with the (first) argument `18`. The `\write`
- the write number, which is actually the file descriptor number
- the string to be written to the given file.
However in the case of file descriptor 18, the descriptor is not an actual
file, but a command line interpreter. That is, any data written to it in the
normal way starts the command interpreter to to carry out the data as a
command.
So \write18 {cmd ...} is actually \write 18 {cmd...}
The problem is that in either form aspell can not understand it as such, and
with any of --add-tex-command="write pp" or --add-tex-command="write18 p",
aspell wants to spell check {cmd ...} either way.
The next step would be to try `\write {18} {cmd ...}` and see what aspell can
do. Such a form however is not accepted by TeX, which complains that {18} is
not a number. The only way to get it working was
\newcommand {\shellcmd} [1] {\write 18 {#1}}
The macro in turn may some implications related to LaTeX command expansion,
if for example the {cmd ...} has some brace '}' or pipes '|' characters in
the command line.
Is there some way to make aspell understand `\write 18 {cmd ...}` ? Can this
be fixed ? Or can this case be documented in the tex mode/filter page in the
documentation ?
Thank you,
Timothy Madden
_______________________________________________
Aspell-user mailing list
https://lists.gnu.org/mailman/listinfo/aspell-user
Kevin Atkinson
2011-09-23 21:59:46 UTC
Permalink
I have unsubscribed you from the list.

It is likely the confirmation mail is somehow getting caught by your spam
filter.
Dear list owner,
I have tried several times to unsubscribe from this list following the
procedure mentioned in
https://lists.gnu.org/mailman/listinfo/aspell-user
It always tells me a confirmation mail is being sent but in fact I don't get
one and I keep being subscribed to the list
Can you have a look at why it doesn't work or at least unsubscribe me
regards,
Hugo
Kevin Atkinson
2011-09-23 22:03:44 UTC
Permalink
Sorry about that, wasn't paying attention to the CC list.
Loading...