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

alexlag/ispapi.python

Repository files navigation

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']

About

Python SDK for ISPRAS API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages