CLAVIN Python API

238 views
Skip to first unread message

Makiko Shukunobe

unread,
Oct 9, 2014, 1:45:10 PM10/9/14
to clavin...@googlegroups.com
Hello,

Greetings. I have a question regarding the Clavin Python API.  I was able to successfully install the Clavin-server and clavin virtual environment.  However, when I run the sample.py script, I receive an error message "raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded".  My guess is that I am not setting the correct index path in the conf/application.conf file.  Clavin and Clavin rest require me to create the Lucene Index, but don't I have to create the Lucene Index using Clavin Python API? (And don't I have to first create the Lucene Index?)  In that case, what should be the index path for  "clavin.index"?  I would very much appreciate your assistance.

Thank you in advance,
Makiko

Travis Pinney

unread,
Oct 17, 2014, 3:51:22 PM10/17/14
to clavin...@googlegroups.com
Hi Makiko,

Thanks for your feedback.

Currently I recommend using the CLAVIN-rest application for doing any type of web services. The contrib code is somewhat experimental and the clavin-server will need to be updated. 

Instructions for building and running the CLAVIN-rest application

# build the REST application
git clone https://github.com/Berico-Technologies/CLAVIN-rest
cd CLAVIN-rest
mvn package 

# download geonames and extract the zip file
unzip allCountries.zip 

# build the index
java -Xmx2048m -jar target/clavin-rest-0.2.0.jar index clavin-rest.yml

# run the server
java -Xmx2048m -jar target/clavin-rest-0.2.0.jar server clavin-rest.yml
curl -s --data @Somalia-doc.txt --header "Content-Type: text/plain" http://localhost:9090/api/v0/geotag

If you are using the python module, try instantiating Clavin like this 


Hope this helps. I will be adding more updates next week.

Best,
Travis

Makiko Shukunobe

unread,
Oct 20, 2014, 3:31:04 PM10/20/14
to Travis Pinney, clavin...@googlegroups.com
Hi Travis,

Thank you so much for your response and instructions for using Clavin-rest.  However, please note we are already using Clavin-rest and are very satisfied with the application.  

The reason we wanted to try the Clavin Python API is that we want to extend the Clavin-rest function by adding a person names extraction function.   We are primarily a GIS group and not trained for programming, but we are very familiar with Python since GIS applications such as ArcGIS and GRASS GIS use Python APIs.  Accordingly, we wrote the code for the person names extraction function using NLTK hoping that the Clavin Python API makes it somewhat easy to implement the extraction function, but it seems we instead need to determine a solution using Clavin-rest.

We would very much appreciate if you could provide your assistance regarding the problem we currently encountered.  We know that "ajax" can call JSON, but we don't know how the Python file should be executed in Clavin-rest in order to produce a JSON file.  We searched possible resolutions and came up with a possible solution that we need to modify the Clavin-server for POST request.  Is there any way to execute Python code and generate a JSON file without modifying the Clavin-server? Or is modifying the Clavin-server is the only way to achieve our objective?

We very much appreciate any suggestion you could provide us. Thanks in advance!

Sincerely yours,
Makiko



--
You received this message because you are subscribed to the Google Groups "clavin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clavin-users...@googlegroups.com.
To post to this group, send email to clavin...@googlegroups.com.
Visit this group at http://groups.google.com/group/clavin-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/clavin-users/c286c4ac-ee8f-4404-bd55-12cf17b6769d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Research Associate
NC State University,
Center for Geospatial Analytics
Box 7106, Jordan Hall 5117
Raleigh, NC 27695
Makiko Shukunobe
Reply all
Reply to author
Forward
0 new messages