Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Latest commit

 

History

History
50 lines (43 loc) · 1.27 KB

README.md

File metadata and controls

50 lines (43 loc) · 1.27 KB

ISPRAS API Python

Installation

  1. To install this SDK run
python setup.py install
  1. You can use pydoc to list available services
pydoc ispras

and check methods for each service

pydoc ispras.texterra
  1. To use any service of ISPRAS API in your project, import subclass of module. For TexterraAPI it looks like this:
from ispras import texterra
  1. 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')
  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
  1. 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']