[Corpora-List] What is best for text processing Perl of Python?

Grzegorz Chrupała grzegorz at pithekos.net
Mon Mar 17 11:32:41 UTC 2008


On Sun, Mar 16, 2008 at 10:19 PM, Steven Bird <sb at csse.unimelb.edu.au> wrote:
> Note that the NLTK book has an appendix in which a simple task
>  (finding all words of a document ending in "ing") is coded in Python,
>  Perl, Prolog, Java, C, LISP, Ruby, Haskell, and Unix shell:
>
>  http://nltk.org/doc/en/nlp-python.html

The Haskell example is unnecessarily obfuscated. A simpler and clearer
solution might be:

import Data.List
main = do
  text <- getContents
  putStr (unlines [ word | word <- words text , "ing" `isSuffixOf` word ])

(Not that I would necessarily recommend Haskell over Python for
teaching to beginners.)
--
Grzegorz

_______________________________________________
Corpora mailing list
Corpora at uib.no
http://mailman.uib.no/listinfo/corpora



More information about the Corpora mailing list