From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 06D5FBBAF for ; Sun, 17 Jan 2010 20:33:41 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqwDAPb0UktQDPIuZWdsb2JhbACPc4wQDQoJBxMFt0CEMgQ X-IronPort-AV: E=Sophos;i="4.49,292,1262559600"; d="scan'208";a="54182265" Received: from smtp21.orange.fr ([80.12.242.46]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Jan 2010 20:33:40 +0100 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2102.orange.fr (SMTP Server) with ESMTP id 13A961C00DF1; Sun, 17 Jan 2010 20:33:40 +0100 (CET) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2102.orange.fr (SMTP Server) with ESMTP id 00CE81C00E1F; Sun, 17 Jan 2010 20:33:40 +0100 (CET) Received: from [192.168.1.102] (c-67-188-6-241.hsd1.ca.comcast.net [67.188.6.241]) by mwinf2102.orange.fr (SMTP Server) with ESMTP id D494D1C00DF1; Sun, 17 Jan 2010 20:33:38 +0100 (CET) X-ME-UUID: 20100117193338870.D494D1C00DF1@mwinf2102.orange.fr X-ME-User-Auth: padator@wanadoo.fr Subject: Re: [Caml-list] porter's stemmer implementation Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=iso-8859-1 From: Yoann Padioleau In-Reply-To: <1ae8fe881001162301y15093c32q23a3f274293fcc38@mail.gmail.com> Date: Sun, 17 Jan 2010 11:33:37 -0800 Cc: caml-list Content-Transfer-Encoding: quoted-printable Message-Id: References: <1ae8fe881001162301y15093c32q23a3f274293fcc38@mail.gmail.com> To: =?iso-8859-1?Q?Gr=E9goire_Seux?= X-Mailer: Apple Mail (2.1077) X-Spam: no; 0.00; gregoire:01 ocaml:01 ocaml:01 def:01 def:01 arneson:01 gregoire:01 beginner's:01 bug:01 beginners:01 wrote:01 dict:01 dict:01 caml-list:01 caml-list:01 On Jan 16, 2010, at 11:01 PM, Gr=E9goire Seux wrote: > Hello, >=20 > I am looking for an implementation of Porter's stemmer in ocaml. There is one in nltk, a very complete python library for NLP and there = is ocamlpython to link ocaml and python code. As the stemmer interface is very simpler (string -> string), it's very easy to use ocamlpython to do = that. Basically you can do in a python file nltk_ocaml,py: import nltk, re stemmer =3D nltk.PorterStemmer() def stem(s): return stemmer.stem(s) def test_nltk_ocaml(): print "test_nltk_ocaml" nltk.draw.tree.demo() and in a ml file nltk.ml: open Pycaml module Py =3D Python=20 let modul =3D Py.cpr (Pycaml.pyimport_importmodule "nltk_ocaml") let dict =3D Py.cpr (Pycaml.pymodule_getdict modul) let stem s =3D=20 let py_str =3D Pycaml.pystring_fromstring s in let f =3D Py.cpr (Pycaml.pydict_getitemstring(dict, "stem")) in let args =3D Py.cpr (Pycaml.pytuple_fromsingle py_str) in let res =3D Py.cpr (Pycaml.pyeval_callobject (f,args)) in Pycaml.guarded_pystring_asstring res > Erik Arneson published a few years ago a link to his implementation, = but the file is no longer available, does someone has a copy of the file = or another implementation ?=20 > By the way, I am looking for every library that could be used in index = construction in Ocaml, of course ! >=20 > Thanks by advance,=20 >=20 > Gregoire Seux > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs