all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* enhance flyspell for german language (+TeX)
@ 2006-02-08 15:12 Sebastian Meisel
  2006-02-09  0:38 ` François Gannaz
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Meisel @ 2006-02-08 15:12 UTC (permalink / raw)


I'm not very good at elisp programming and that is actually to tough for me. 
Hopefully some of you can help me.

In german language there are many combined words, many of which are of the 
form: Word+s+word or Word+en+word. Ispell has difficulties with these. Now I 
have an idea how to enhance the behavior of ispell using flyspell und latex 
hyphenationmarks.

flyspell should do the following:

When it comes to a word contaning one or more german hyphenation mark ("-) an 
ispell-parser is set to 'tex and dictionary is "german" or "german8" it shall 

1) check each of the components  of the word with ispell
2) if it fails for one, check it capitalized
3) if it still fails and the words end on -s or -en, check it without these 
and capitalized.

That's to complex for me to program it, but I think it should be possible with 
elisp. I'd be very thankfull, if some one could do that job for me.
 
-- 
Sebas茶an Meisel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enhance flyspell for german language (+TeX)
  2006-02-08 15:12 enhance flyspell for german language (+TeX) Sebastian Meisel
@ 2006-02-09  0:38 ` François Gannaz
  2006-02-09  9:36   ` Peter Dyballa
  2006-02-09 10:15   ` Sebastian Meisel
  0 siblings, 2 replies; 6+ messages in thread
From: François Gannaz @ 2006-02-09  0:38 UTC (permalink / raw)


Le mer 08 fév 16:12, Sebastian Meisel a écrit :
> I'm not very good at elisp programming and that is actually to tough for me. 
> Hopefully some of you can help me.
> 
> In german language there are many combined words, many of which are of the 
> form: Word+s+word or Word+en+word. Ispell has difficulties with these. Now I 
> have an idea how to enhance the behavior of ispell using flyspell und latex 
> hyphenationmarks.

Does aspell have the same problem ? You can substitute it to ispell with
(setq-default ispell-program-name "aspell")
Aspell is supposed to be more evolved than ispell, but i never tested it
with a german text. It works ok with french, though.
--
François

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enhance flyspell for german language (+TeX)
  2006-02-09  0:38 ` François Gannaz
@ 2006-02-09  9:36   ` Peter Dyballa
  2006-02-09 10:15   ` Sebastian Meisel
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2006-02-09  9:36 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 09.02.2006 um 01:38 schrieb François Gannaz:

> Aspell is supposed to be more evolved than ispell, but i never  
> tested it
> with a german text. It works ok with french, though.

For me aspell works worse: it breaks the German words at umlauts and  
ß. It does not seem to matter whether the text is in some ISO-Latin  
or UTF-8 encoding.

Could you mention how you make aspell accept the accented 8 bit  
characters in French?

--
Greetings

   Pete

A child of five could understand this!  Fetch me a child of five.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enhance flyspell for german language (+TeX)
  2006-02-09  0:38 ` François Gannaz
  2006-02-09  9:36   ` Peter Dyballa
@ 2006-02-09 10:15   ` Sebastian Meisel
  2006-02-09 11:37     ` François Gannaz
  1 sibling, 1 reply; 6+ messages in thread
From: Sebastian Meisel @ 2006-02-09 10:15 UTC (permalink / raw)


Not only does  aspell have the same problems, but for me it made flyspell 
crash very often. I also don't think, that a word-by-word spell-program is 
the place were that problem can be solved, as flyspell would only give part 
of the word to the spell programm, if I use "-. Or can I make flyspell 
provide the whole word to the spell programm.  I could then write a 
perl-script as a pipe, which does the job, I'd like flyspell to do. Allthough 
I think that flyspell would be the better place, an probably the faster 
solution.

Am Donnerstag, 9. Februar 2006 01:38 schrieb François Gannaz:
> Le mer 08 fév 16:12, Sebastian Meisel a écrit :
> > I'm not very good at elisp programming and that is actually to tough for
> > me. Hopefully some of you can help me.
> >
> > In german language there are many combined words, many of which are of
> > the form: Word+s+word or Word+en+word. Ispell has difficulties with
> > these. Now I have an idea how to enhance the behavior of ispell using
> > flyspell und latex hyphenationmarks.
>
> Does aspell have the same problem ? You can substitute it to ispell with
> (setq-default ispell-program-name "aspell")
> Aspell is supposed to be more evolved than ispell, but i never tested it
> with a german text. It works ok with french, though.
> --

-- 
Bis dann und wann Sebas茶an

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enhance flyspell for german language (+TeX)
  2006-02-09 10:15   ` Sebastian Meisel
@ 2006-02-09 11:37     ` François Gannaz
  2006-02-10 19:20       ` Sebastian Meisel
  0 siblings, 1 reply; 6+ messages in thread
From: François Gannaz @ 2006-02-09 11:37 UTC (permalink / raw)


Le jeu 09 fév 11:15, Sebastian Meisel a écrit :
> Not only does  aspell have the same problems, but for me it made flyspell 
> crash very often. I also don't think, that a word-by-word spell-program is 
> the place were that problem can be solved, as flyspell would only give part 
> of the word to the spell programm, if I use "-. Or can I make flyspell 
> provide the whole word to the spell programm.  I could then write a 
> perl-script as a pipe, which does the job, I'd like flyspell to do. Allthough 
> I think that flyspell would be the better place, an probably the faster 
> solution.

Modifying flyspell is too big a task for me, so I just thought it was
worth to try if aspell behaved better on combined words.

There is a flyspell-incorrect-hook, so you might use it to forward the
word (or the sentence) to perl. It could also be used to enhance
flyspell in lisp, I guess.

By the way, I saw this in flyspell.el :
(defcustom flyspell-dictionaries-that-consider-dash-as-word-delimiter
  '("francais" "deutsch8" "norsk")
But I don't know if it's useful.

--
François

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: enhance flyspell for german language (+TeX)
  2006-02-09 11:37     ` François Gannaz
@ 2006-02-10 19:20       ` Sebastian Meisel
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Meisel @ 2006-02-10 19:20 UTC (permalink / raw)


> There is a flyspell-incorrect-hook, so you might use it to forward the
> word (or the sentence) to perl. It could also be used to enhance
> flyspell in lisp, I guess.
>
Well it took me some time, but finally I made it. I use (thank's for the tip)
the flyspell-incorrect-hook: 

----------->
(add-hook 'flyspell-incorrect-hook 'flyspell-zusammen())

(defun flyspell-zusammen (beg end poss)
"This function is to be called by 'flyspell-incorrect-hook. It looks for 
german hyphenationmarks (\"-) and 
checks if the 'misspelled words could be correct parts of combined word in 
german language."
(if (re-search-backward "\"-" (- beg 2) t) 
    (if (when (consp poss)
	  (setq temp-buffer (get-buffer-create " *flyspell-temp*"))
	  (save-excursion
	    (copy-to-buffer temp-buffer beg end)
	    (set-buffer temp-buffer)
	    (goto-char (point-min))
	    (setq word (capitalize (buffer-string)))
	    (when (member word (nth 2 poss)) t) 
	    )) t) ;; (if (when (consp poss)  
      (if (and (re-search-forward "-" (+ end 2) t)  
	       (or (re-search-backward "s" (1- end) t)
		   (re-search-backward "e" (1- end) t)))
	(if (when (consp poss)
	      (setq temp-buffer (get-buffer-create " *flyspell-temp*"))
	      (save-excursion
		(copy-to-buffer temp-buffer beg (1- end))
		(set-buffer temp-buffer)
		(goto-char (point-min))
		(setq word (capitalize (buffer-string)))
		(when (member word (nth 2 poss)) t)
		)) t) nil)))
<---------

It considers Operations"-geräte, Frauen"-park"-platz, Mause"-loch as correct. 
This could make life a bit easier for german writer using latex.  There still 
are some shortcomings however, but I think I can live with it:

When these words repeat in a text, they are highlighted yellow. 
When a word is once marked as incorrect the hook is called no more. 

The only workaround is to delete the word an paste it.

I hope someone is testing that, and shares her/his experiences with me.
-- 
Sebastian Meisel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-10 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-08 15:12 enhance flyspell for german language (+TeX) Sebastian Meisel
2006-02-09  0:38 ` François Gannaz
2006-02-09  9:36   ` Peter Dyballa
2006-02-09 10:15   ` Sebastian Meisel
2006-02-09 11:37     ` François Gannaz
2006-02-10 19:20       ` Sebastian Meisel

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.