Small HTTP server that allows you to access Relex – the Natural Language Processing capabilities of the OpenCog project. This project loads Relex and all it’s Java dependencies into a small Ruby/Sinatra server and exposes it’s functionality through JSON calls.
The Relex tools are very powerful and they have many Java and C++ dependencies. In order to communicate with it in a performant way, we need to make sure that the Relex process + JVM keeps on running. Relex comes with it’s own TCP-based RPC server which is mainly focussed on OpenCog integration. This project attempts to make the functionality available through HTTP JSON RPC calls.
- Developers that need access to some of the most powerful NLP tools
- Developers that quickly need JSON output of a parse
- Developers that use web-flavoured frameworks: jQuery, NodeJS, Rails, Sinatra, etc…
To learn more about Relex & it’s dependencies, please visit the OpenCog website.
- Java VM
- Linkgrammar and it’s Java bindings
- Wordnet
- Most (cross-platform) JAR files are in dependencies/*, including Relex.
- Ruby and these gems:
sudo gem install json sudo gem install sinatra sudo gem install rjb
$ ruby relex.rb Java VM, loading: commons-logging.jar Java VM, loading: jwnl.jar Java VM, loading: linkgrammar-4.6.5.jar Java VM, loading: relex-1.2.1.jar == Sinatra/0.9.4 has taken the stage on 9090 for development with backup from Mongrel
$ wget http://localhost:9090/frames?text=I am eating a pear
{
"Transitive_action": [{
"Patient": ["eat", "pear"]
},
{
"Agent": ["eat", "I"]
}],
"Process_continue": [{
"Time": ["present", "present"]
},
{
"Event": ["eat", "eat"]
}],
"Ingestion": [{
"Ingestibles": ["eat", "pear"]
},
{
"Ingestor": ["eat", "I"]
}]
}
$ wget http://localhost:9090/phrase_tree?text=I am eating a pear
{
"string": "(S (NP I) (VP am (VP eating (NP a pear))) .)",
"tree_array": [[{
"phrase": "I",
"pos": "NP"
}], [[[{
"phrase": "a pear",
"pos": "NP"
}], {
"phrase": "eating ",
"pos": "VP"
}], {
"phrase": "am ",
"pos": "VP"
}], {
"phrase": "",
"pos": "S"
}],
"flat_array": [{
"phrase": "I",
"pos": "NP"
},
{
"phrase": "a pear",
"pos": "NP"
},
{
"phrase": "eating ",
"pos": "VP"
},
{
"phrase": "am ",
"pos": "VP"
},
{
"phrase": "",
"pos": "S"
}]
}
- Expose more functionality
- Integration tests
- Caching mechanisms
- Stress testing
MIT, but who cares?