On Jan 2, 2015, at 11:38 AM, Jens Axel Søgaard wrote: > 2015-01-02 17:10 GMT+01:00 Matthias Felleisen <[email protected]>: >> >> Jens -- thanks for re-directing us to your article. This saved me quite >> some time. I noticed the lacking abstractions (slicing, comprehension) >> and considered sketching a prototype to use with this program. I decided >> to wait till today because it didn't address what bothered me most: >> >> speed. > > One trick: change the regular expression in words in order to > get rid of the call to string-downcase: > > (regexp-split #rx"[^a-zA-Z]" buf) > > Another trick: the regular expression matchers in Racket works both > on strings and ports, so train can be written > > (define (train fname) > (freqs (words (open-input-file fname)))) > > I am not sure whether it will give a speedup though.
Both of these caused a serious slowdown. -- Matthias ____________________ Racket Users list: http://lists.racket-lang.org/users

