> "Stephen" == Stephen J Turnbull
Uwe Brauer writes:
> - a function which does the replacement and
(while (search-forward TARGET nil t)
is extremely fast assuming multiple replacements per TARGET. If you
expect most of your words to occur many times, I would put this in the
inner loop unless your file is more than a megabyte or two.
Depends on what you're going to do with it. If you're just
search one file for each word once, 2000 or 3000 is not that big. I
would guess that the very naive program which loops over words and
searches the whole file for each one as in the while-search-forward
loop would take minutes (maybe up to 30, but I bet much less).
The idea is to have a pkg which I could apply to any file with hebrew
text in the future. These files itself maybe small, corresponding to 2 o
three written pages. However the list containing niqqud and no niqqud
could have at least 2000 entries maybe more.
The code I was thinking to use is basically as follows
(defun niqqud-translate-conventions (trans-tab)
"Use the translation table argument to translate the current buffer."
(let ((beg (point-min-marker))
(let ((buffer-read-only nil) ; (inhibit-read-only t)?
(let ((trans-this (car trans-tab)))
(while (search-forward (car trans-this) nil t)
(replace-match (car (cdr trans-this)) t t)))
(setq trans-tab (cdr trans-tab))))))
(narrow-to-region beg end)))))
I am not sure the narrow stuff is necessary, the basic functionality is
"Translation table from niqqud to NO niqqud.")
(defun hebrew-fix-niqqud ()
(let ((buffer-modified-p (buffer-modified-p)))
And the question is how big could niqqud-trans-tab be. 10 Megas?
I see the code you have in mind is very different.
BTW which format is supposed to have your file "load-my-table.el" ?
Thanks to both of you.
XEmacs-Beta mailing list