
5 Aug
2009
5 Aug
'09
6:53 a.m.
Hi Gwern, gwern0 wrote:
...efficiency is an issue.
Here are a few efficiency issues that I noticed in your algorithm after a quick look (none of these have to do with Haskell really): o ranks sorts the entire set, then discards all but the maximum. It would be better to use maximum or maximumBy. If you are worried about the empty set, check that separately. o You recompute the same rank value repeatedly for every word in each sentence. Use a "let" clause in your list comprehension to do it only once per sentence. o approximation rescans the entire corpus after discarding each word. Try to think of a way to recompute only those sentences that contained the word. Hope this helps, Yitz