Hi Wilker

You  need to link with libmoses.a and libmoses_internal.a

I managed to access the Moses libraries using boost python - to query 
the binarised phrase tables - contact me offline if you want me to send 
you the code.

cheers - Barry

On 10/09/12 17:40, Wilker Aziz wrote:
> Hi everyone,
>
> I'm trying to wrap a few things from Moses using cython.
> I started with a "simple" piece of code that tries to construct a 
> PhraseDictionaryTree.
>
> This is my binpt.pxd
> cdef extern from 'PhraseDictionaryTree.h' namespace 'Moses':
>     cdef cppclass PhraseDictionaryTree:
>         PhraseDictionaryTree(unsigned nscores)
>
> This is my binpt.pyx
> cdef class PhraseTable:
>     cdef PhraseDictionaryTree* tree
>     def __cinit__(self, int nscores = 5):
>         self.tree = new PhraseDictionaryTree(nscores)
>
> My setup.py looks like this:
> from distutils.core import setup
> from distutils.extension import Extension
> ext_modules = [
>     Extension(name='binpt',
>         sources=['python/binpt/binpt.cpp'],
>         language='C++',
>         include_dirs=['.','moses/src','util'],
>         library_dirs=['lib'],
>         libraries=['stdc++', 'moses'],
>         extra_compile_args=['-O3', '-DNDEBUG'])
> ]
> setup(
>     name='binpt',
>     ext_modules=ext_modules
> )
>
> It builds ( python setup.py build_ext -i ) , apparently without 
> problems .
> When I go to python to import the code I get an error message:  
> ImportError: ./binpt.so: undefined symbol: 
> _ZN5Moses20PhraseDictionaryTreeC1Em
>
> I tried to grep that symbol from  nm lib/libmoses.a  and it wasn't there.
> Would anyone know if I'm looking for it in the wrong place?
> Is there any comments/directions you could suggest?
>
> Appreciate your help.
>
> Cheers,
>
> -- 
> Wilker Aziz
> http://pers-www.wlv.ac.uk/~in1676/ <http://pers-www.wlv.ac.uk/%7Ein1676/>
>
> PhD candidate at The Research Group in Computational Linguistics
> Research Institute of Information and Language Processing (RIILP)
> University of Wolverhampton
> MB108
> Stafford Street
> WOLVERHAMPTON WV1 1LY
>
>
>
> _______________________________________________
> Moses-support mailing list
> Moses-support@mit.edu
> http://mailman.mit.edu/mailman/listinfo/moses-support


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to