3

我想在 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 系统,我不知道该尝试什么了。

如果您需要我提供更多信息,请告诉我。

编辑:在他们的常见问题部分中,他们声明 API makefile 仅适用于 Unix,但理论上我可以在 Windows 上复制这些步骤。但我真的不知道该怎么做,所以如果你们中的任何人能帮助我,我将非常感激。

生成文件如下所示:

# 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*
4

0 回答 0