Skip to main content

Python binding to the SupWSD RESTful service.

Project description

SupWSD

SupWSD is a Python binding to an HTTP RESTful service that gives you programmatic access to SupWSD, a framework for supervised Word Sense Disambiguation (WSD).

Before using the services, you must first register on SupWSD. At the end of the registration process, you will receive an email with the API key.

The SupWSD service is available for English, French, German, Italian and Spanish and enforces a default limit of 10.000 free requests per 1 hour period.

The SupWSD Python API requires python 2.7 or above.

LICENSES: All the data of the external resources are released under the terms of the respective licenses.

Installation

pip install supwsd

Code Example

from it.si3p.supwsd.api import SupWSD
from it.si3p.supwsd.config import Model, Language

text="The human " + SupWSD.SENSE_TAG + "brain" + SupWSD.SENSE_TAG + " is quite proficient at word-sense disambiguation. The fact that natural language is formed "+ SupWSD.SENSE_TAG+"in a way"+ SupWSD.SENSE_TAG+" that requires so much of it is a " + SupWSD.SENSE_TAG + "reflection" + SupWSD.SENSE_TAG + " of that neurologic reality."

for result in SupWSD('apiKey').disambiguate(text,Language.EN,Model.SEMCOR_EXAMPLES_GLOSSES_ONESEC_OMSTI, False, Language.IT,Language.FR):
        token=result.token
        print("Word: {}\tLemma: {}\tPOS: {}\tTag: {}".format(token.word, token.lemma,token.pos,token.tag))

        if not result.miss():
            for sense in result.senses:
                print("Sense {}\tProbability: {}".format(sense.id, sense.probability))   

            for translation in result.translations:
            	print(translation)  

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for supwsd, version 1.2.9
Filename, size File type Python version Upload date Hashes
Filename, size supwsd-1.2.9-py2.py3-none-any.whl (10.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size supwsd-1.2.9.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page