Browse thread
porter's stemmer implementation
-
Grégoire_Seux
- Richard Jones
-
Yoann Padioleau
- Guillaume Yziquel
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Guillaume Yziquel <guillaume.yziquel@c...> |
| Subject: | Re: [Caml-list] porter's stemmer implementation |
Yoann Padioleau a écrit :
> On Jan 16, 2010, at 11:01 PM, Grégoire Seux wrote:
>
> 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.
>
> open Pycaml
>
> module Py = Python
> let modul = Py.cpr (Pycaml.pyimport_importmodule "nltk_ocaml")
> let dict = Py.cpr (Pycaml.pymodule_getdict modul)
>
> let stem s =
> let py_str = Pycaml.pystring_fromstring s in
> let f = Py.cpr (Pycaml.pydict_getitemstring(dict, "stem")) in
> let args = Py.cpr (Pycaml.pytuple_fromsingle py_str) in
> let res = 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
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 = Python;;
Error: Unbound module Python
# module X = Pycaml.Python;;
Error: Unbound module Pycaml.Python
# module X = Pycaml;;
module X :
sig
type funcptr = Pycaml.funcptr
type pyobject = Pycaml.pyobject
type funcent = funcptr * int * int
type pymodule_func =
Pycaml.pymodule_func = {
pyml_name : string;
pyml_func : pyobject -> pyobject;
pyml_flags : int;
pyml_doc : string;
}
type pyobject_type =
Pycaml.pyobject_type =
TupleType
| StringType
| IntType
| FloatType
| ListType
| NoneType
| CallableType
Where did you get your pycaml from?
All the best,
--
Guillaume Yziquel
http://yziquel.homelinux.org/