问题
I am trying to use hunspell
to correct an essay i have written. Unfortunately it is useless to me, as long as it doesn't print the line number of the word, which it predicts to be misspelled.
So right now I am using the -a
option, to be able to pipe it into hunspell
. The man page says, that the -L
option would "Print lines with misspelled words.". But I don't see any difference in the output.
This is what I do right now:
cat myessay.txt | hunspell -d en_US,de_DE -a -L
An example output looks like this:
& JavaServer 3 412: Java Server, Java-Server, Javasee
The word "JavaServer" is in line 78, and as described in the man-pages, it really has an offset of 412 characters in that line.
Is there something I am missing? Is there an easy solution to this problem, or do I really have to pipe each line into hunspell to find out at which line number it was?
Thanks in advance
回答1:
Now I actaully downloaded the sources of hunspell and got down to business.
There is an undocumented switch -u
that gives me a comfortable output to work with. e.g.
hunspell -u -d en_US,de_DE myessay.txt
This does the trick for printing line numbers using a german and an american dictionary. Alternatively, you can use -U
to get a excerpt of the text as well. Other available undocumented switches are -u2
and -u3
But be careful: Those switches are experimental and the source-code says, that those functions are missing unicode support.
来源:https://stackoverflow.com/questions/10617743/hunspell-printing-the-line-number-of-the-corrected-word