semanticize / st

Semanticizest: dump parser and client
Apache License 2.0
20 stars 4 forks source link

Add python wrapper #5

Closed c-martinez closed 9 years ago

c-martinez commented 9 years ago

Probably trivial, but maybe nice to have.

larsmans commented 9 years ago

Great idea, but needs testing. Also, I think it's a better idea to feed data as JSON on the semanticizer's stdin; that allows for more options.

The Travis failure is unrelated, looks like the latest Go build broke the C-Go bindings. Will fix that.

tgalery commented 9 years ago

It would be also nice to update the README with some documentation on how to use the wrapper.

larsmans commented 9 years ago

... and there needs to be a way to install it. I'll merge the wrapper into a separate branch.

c-martinez commented 9 years ago

I'll add some documentation on how to use the wrapper to the README.

For the testing -- I'm assuming we use the 'nlwiki-20140927-sample.xml' to build a test model?

tgalery commented 9 years ago

I think another worry would be the overhead of having python to start a shell process (which on its turn) accesses databases and so on. An http wrapper over the go server might perform better, no ?

tgalery commented 9 years ago

Another thought would be just develop some very small python code, that just reads the data from the model and exposes that directly (if the data format is the same as semanticizest, we could use that directly, I'm not sure it is though)

c-martinez commented 9 years ago

HTTP wrapper would be better if go server runs on different machine -- but I'm guessing that is what will have to be done if we want st to be integrated into xtas. Shell process is intended as a quick-and-easy way of getting started.

Reading the model from Python, I think would be possible, but I thought the hash functions used in go might require a bit of work.

Perhaps @larsmans has an opinion on this?

larsmans commented 9 years ago

Reading the model "directly" means doing the exact same tokenization and hashing, so keeping two implementations aligned.

larsmans commented 9 years ago

In cfbc2b3613ca0b489eebcb8adaf2827b7414eed2, I made it easier to start an HTTP server locally, using a random port number.

c-martinez commented 9 years ago

Now using HTTP instead of subprocess (although http server can be started on a subprocess). So it can run locally (for ease) or using a remote server (for performance).

larsmans commented 9 years ago

82a3a647c52bdee265001109a4f64fa2b6de43ce is a refactoring of this code.

larsmans commented 9 years ago

Merged most of this from the command line. Python wrapper is now in master. Thanks @c-martinez! (Now to get Travis to run the tests...)