- To install this SDK run
python setup.py install
- You can use pydoc to list available services
pydoc ispras
and check methods for each service
pydoc ispras.texterra
- To use any service of ISPRAS API in your project, import subclass of module. For TexterraAPI it looks like this:
from ispras import texterra
- Now you can create an access object using your Apikey:
t = texterra.API('YOURKEY')
You can also specify service name and version:
t = texterra.API('YOURKEY', 'texterra', 'v3.1')
- To access different tools just call corresponding method:
tags = t.posTaggingAnnotate('Hello World')
# You can also invoke Texterra with custom request:
result = t.customQuery(path, query) # for GET request
result = t.customQuery(path, query, form) # for POST request
- Methods return dictionary, so you can navigate through it according to API documentation:
for annotation in tags:
print annotation['text']
Use '@' before atrribute names and '#text' to access own text of nodes. Use only node name to access its text if there are no attributes or subnodes:
print an['value']['@class'], an['value']['#text']