我想使用Python中的FreeLing工具。我能够将它用作我的ubuntu系统上的模块,因为那里的安装非常简单。但是现在我需要让它在Windows上运行,因为脚本的最终用户只使用Windows。
我希望能够像模块一样调用freeling库,如下例所示: https://github.com/TALP-UPC/FreeLing/blob/master/APIs/python/sample.py
我也找不到任何关于如何做到这一点的窍门,有关于如何在Windows上使用freeling(但不是作为python模块)或如何使用freeling作为python模块的教程(但仅限于Unix系统) )。
FreeLing的API文件夹中的makefile只适用于Unix系统,我不知道该怎么办。
如果您需要我提供更多信息,请告诉我。
编辑: 在他们的FAQ部分中,他们声明API makefile仅适用于Unix,但理论上我可以在Windows上复制这些步骤。但我真的不知道该怎么做,所以如果你们中的任何人能帮助我,我将非常感激。
makefile如下所示:
# You may need to change these paths to match your installation.
# Alternatively, you can call 'make' overriding variable values, E.g.:
# make FREELINGDIR=/my/freeling/dir PYTHONDIR=/my/python/dir
FREELINGDIR = /usr/local
PYTHONVER = python3.5.2
PYTHONDIR = /usr/include/$(PYTHONVER)
_freeling.so: freeling_pythonAPI.cxx
g++ -shared -o _freeling.so freeling_pythonAPI.cxx -lfreeling -I$(FREELINGDIR)/include -L$(FREELINGDIR)/lib -I$(PYTHONDIR) -fPIC -std=gnu++0x
# Mac OSX users: Comment the line above, and uncomment the line below:
# g++ -dynamiclib -o _freeling.so freeling_pythonAPI.cxx -lboost_system -l$(PYTHONVER) -lfreeling -I$(FREELINGDIR)/include -L$(FREELINGDIR)/lib -I$(PYTHONDIR) $(CPPFLAGS) $(LDFLAGS) -fPIC -std=c++0x
freeling_pythonAPI.cxx: freeling_pythonAPI.i ../common/freeling.i ../common/templates.i
swig -python -py3 -c++ -o freeling_pythonAPI.cxx freeling_pythonAPI.i
# Python2 users: Remove option "-py3" from the above line
clean:
rm -rf __pycache__ freeling_pythonAPI.cxx _freeling.so freeling.py*