Can I call external *python* functions from google refine?

南笙酒味 提交于 2019-12-05 08:54:27

问题


I'm investigating Google refine to speed up some of my data work -- never used it before this week, but I like a lot of what I see.

My biggest question so far is whether it's possible to call external python functions from Refine. I know you can call jython internally, but that doesn't provide access to C-based python libraries (e.g. lxml), and I have scripts elsewhere that I'd like to integrate, without lots of copy-paste or rewrite hassle.

What options are there for doing this in Refine? I'm willing to get creative -- I just want a stable, re-usable solution.


回答1:


As Google Refine Wiki says:

lxml will NOT work in Jython, since lxml has C bindings for CPython (regular Python), hence will not work in Refine which is Jython / Java only, and has no CPython interpreter built-in

But you can try Google Refine Python Client Library to create projects and manipulate your data programmatically.




回答2:


I'm going to mark reclosedev's answer as accepted, but there's still a litle more to the story.

The other answer to this question is that you can set up your own python-based API. For this project, I was able to set up a django app running on a local server. It only took an hour or so to build the API to my existing library.

More hassle than I'd have liked, but it fit the bill for this project without soaking up too much time.



来源:https://stackoverflow.com/questions/9117349/can-i-call-external-python-functions-from-google-refine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!