From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2DACCBBAF for ; Mon, 18 Jan 2010 01:49:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwBAI4+U0tV2gB5mWdsb2JhbACDYJgYAQEBAQEICwoHE6s+jDiBLIIwVgSJOQ X-IronPort-AV: E=Sophos;i="4.49,293,1262559600"; d="scan'208";a="41629665" Received: from emailfrontal2.citycable.ch ([85.218.0.121]) by mail2-smtp-roc.national.inria.fr with SMTP; 18 Jan 2010 01:49:46 +0100 Received: from [192.168.0.12] (unknown [85.218.92.99]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal2.citycable.ch (Postfix) with ESMTPA id E2C0DB10411; Mon, 18 Jan 2010 01:49:43 +0100 (CET) Message-ID: <4B53B027.3060107@citycable.ch> Date: Mon, 18 Jan 2010 01:49:43 +0100 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: Yoann Padioleau Cc: =?UTF-8?B?R3LDqWdvaXJlIFNldXg=?= , caml-list Subject: Re: [Caml-list] porter's stemmer implementation References: <1ae8fe881001162301y15093c32q23a3f274293fcc38@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 ocaml:01 ocaml:01 usr:01 lib:01 usr:01 lib:01 sig:01 flags:01 unbound:01 unbound:01 wrote:01 unix:01 dict:01 Yoann Padioleau a =C3=A9crit : > On Jan 16, 2010, at 11:01 PM, Gr=C3=A9goire Seux wrote: >=20 > 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 d= o that. >=20 > open Pycaml >=20 > module Py =3D Python=20 > let modul =3D Py.cpr (Pycaml.pyimport_importmodule "nltk_ocaml") > let dict =3D Py.cpr (Pycaml.pymodule_getdict modul) >=20 > 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 I'm afraid I do not understand where you get your Python module from and=20 you Py.cpr value from. I get from the Debian pycaml package: # #require "pycaml";; /usr/lib/ocaml/unix.cma: loaded /usr/lib/ocaml/pycaml: added to search path /usr/lib/ocaml/pycaml/pycaml.cma: loaded # module X =3D Python;; Error: Unbound module Python # module X =3D Pycaml.Python;; Error: Unbound module Pycaml.Python # module X =3D Pycaml;; module X : sig type funcptr =3D Pycaml.funcptr type pyobject =3D Pycaml.pyobject type funcent =3D funcptr * int * int type pymodule_func =3D Pycaml.pymodule_func =3D { pyml_name : string; pyml_func : pyobject -> pyobject; pyml_flags : int; pyml_doc : string; } type pyobject_type =3D Pycaml.pyobject_type =3D TupleType | StringType | IntType | FloatType | ListType | NoneType | CallableType Where did you get your pycaml from? All the best, --=20 Guillaume Yziquel http://yziquel.homelinux.org/