Skip to main content

Python Wrapper for ParallelDots APIs

Project description

ParallelDots-Python-API
=======================

A wrapper for the `ParallelDots API <http://www.paralleldots.com>`__.

Installation
------------

>From PyPI:

::

pip install paralleldots

>From Source:

::

https://github.com/ParallelDots/ParallelDots-Python-API.git
python setup.py install

API Keys & Setup
----------------

Signup and get your free API key from
`ParallelDots <http://www.paralleldots.com/pricing>`__. You will receive
a mail containing the API key at the registered email id.

Configuration:

::

>>> from paralleldots import set_api_key, get_api_key

# Setting your API key
>>> set_api_key( "YOUR API KEY" )

# Viewing your API key
>>> get_api_key()

Languages Supported:
-------------------

- Portuguese ( pt )
- Chinese ( zh )
- Spanish ( es )
- German ( de )
- French ( fr )
- Dutch ( nl )
- Italian (it)
- Japanese ( ja )
- Indonesian ( id )
- Thai ( th )
- Danish ( da )
- Finish ( fi )

Supported APIs:
---------------

- Abuse
- Custom Classifier
- Emotion
- Facial Emotion
- Intent
- Keywords
- Multilanguage Keywords ( Supports Multiple Languages )
- Named Entity Extraction/Recognition ( NER )
- Not Safe For Work ( NSFW Image Classifier )
- Phrase Extractor
- Popularity ( Image Classifier )
- Object Recognizer
- Sentiment Analysis
- Semantic Similarity
- Taxonomy
- Text Parser
- Usage

Examples
--------

::

Examples
--------

>>> import paralleldots

>>> api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
>>> text = "Prime Minister Narendra Modi tweeted a link to the speech Human Resource Development Minister Smriti Irani made in the Lok Sabha during the bate on the ongoing JNU row and the suicide of Dalit scholar Rohith Vemula at the Hyderabad Central University."
>>> path = "/home/my_computer/Downloads/image_1.jpg"
>>> lang_code = "fr"
>>> lang_text = "C'est un environnement très hostile, si vous choisissez de débattre ici, vous serez vicieusement attaqué par l'opposition."
>>> category = { "finance": [ "markets", "economy", "shares" ], "world politics": [ "diplomacy", "UN", "war" ], "india": [ "congress", "india", "bjp" ] }
>>> url = "http://i.imgur.com/klb812s.jpg"


>>> paralleldots.set_api_key( api_key )
>>> print( "API Key: %s" % paralleldots.get_api_key() )

>>> print( "\nAbuse" )
>>> print( paralleldots.abuse( text ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "sentence_type":"Non Abusive", "confidence_score":0.876953}

>>> print( "\nCustom Classifier" )
>>> print( paralleldots.custom_classifier( text, category ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "taxonomy":[{"tag":"world politics", "confidence_score":0.580833}, {"tag":"finance", "confidence_score":0.259185}]}

>>> print( "\nEmotion" )
>>> print( paralleldots.emotion( text ) )
{"emotion":{"emotion":"Happy", "probabilities":{"Sarcasm":0.0, "Angry":0.04090321436524391, "Sad":0.0, "Fear":0.0, "Bored":0.0, "Excited":0.07638891041278839, "Happy":0.1223890483379364}}, "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nEmotion - Lang: Fr". )
>>> print( paralleldots.emotion( lang_text, lang_code ) )
{"emotion":{"emotion":"Angry", "probabilities":{"Sarcasm":0.052613839507102966, "Angry":0.07304570078849792, "Sad":0.051657479256391525, "Fear":0.07096020132303238, "Bored":0.0, "Excited":0.0, "Happy":0.0}}, "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nFacial Emotion" )
>>> print( paralleldots.facial_emotion( path ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "output":"No face detected."}

>>> print( "\nFacial Emotion: URL Method" )
>>> print( paralleldots.facial_emotion_url( url ) )
{"facial_emotion":[{"score":0.439317524433136, "tag":"Angry"}, {"score":0.18545667827129364, "tag":"Surprise"}, {"score":0.11217296868562698, "tag":"Sad"}, {"score":0.08146321028470993, "tag":"Neutral"}, {"score":0.06052987277507782, "tag":"Happy"}, {"score":0.06052987277507782, "tag":"Fear"}, {"score":0.06052987277507782, "tag":"Disgust"}], "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: https://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nIntent" )
>>> print( paralleldots.intent( text ) )
{"probabilities":{"marketing":0.042, "spam/junk":0.003, "news":0.927, "feedback/opinion":0.024, "query":0.004}, "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "intent":"news"}

>>> print( "\nKeywords" )
>>> print( paralleldots.keywords( text ) )
{"keywords":[{"keyword":"Prime Minister Narendra Modi", "confidence_score":0.857594}, {"keyword":"link", "confidence_score":0.913924}, {"keyword":"speech Human Resource", "confidence_score":0.70655}, {"keyword":"Smriti", "confidence_score":0.860351}, {"keyword":"Lok", "confidence_score":0.945534}], "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nLanguage Detection" )
>>> print( paralleldots.language_detection( lang_text ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "output":"French", "code":200, "prob":0.9999592304229736}

>>> print( "\nMultilang Keywords - Lang: Fr". )
>>> print( paralleldots.multilang_keywords( lang_text, lang_code ) )
{"keywords":["cest", "très", "vicieusement", "attaqué", "hostile", "environnement", "débattre", "choisissez", "lopposition", "si"], "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nNER" )
>>> print( paralleldots.ner( text ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "entities":[{"category":"name", "name":"Narendra Modi", "confidence_score":0.990574}, {"category":"name", "name":"Smriti Irani", "confidence_score":0.989922}, {"category":"name", "name":"Rohith Vemula", "confidence_score":0.839291}, {"category":"group", "name":"Lok Sabha", "confidence_score":0.80819}, {"category":"group", "name":"Dalit", "confidence_score":0.655424}, {"category":"group", "name":"Central University", "confidence_score":0.708817}, {"category":"place", "name":"Hyderabad", "confidence_score":0.591985}]}

>>> print( "\nNSFW" )
>>> print( paralleldots.nsfw( path ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "output":"not safe to open at work", "prob":0.9995405673980713}

>>> print( "\nNSFW: URL Method" )
>>> print( paralleldots.nsfw_url( url ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: https://www.paralleldots.com/terms-and-conditions", "output":"safe to open at work", "prob":0.979527473449707}

>>> print( "\nObject Recognizer" )
>>> print( paralleldots.object_recognizer( path ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "output":[{"score":0.8445611596107483, "tag":"Muscle"}, {"score":0.6443125605583191, "tag":"Limb"}, {"score":0.5493743419647217, "tag":"Arm"}, {"score":0.5155590772628784, "tag":"Person"}, {"score":0.39905625581741333, "tag":"Human body"}, {"score":0.39764025807380676, "tag":"Leg"}, {"score":0.3255367875099182, "tag":"Hand"}, {"score":0.2798691689968109, "tag":"Male person"}, {"score":0.25423258543014526, "tag":"Adult"}, {"score":0.2470093071460724, "tag":"Man"}]}

>>> print( "\nObject Recognizer: URL Method" )
>>> print( paralleldots.object_recognizer_url( url ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: https://www.paralleldots.com/terms-and-conditions", "output":[{"score":0.8752718567848206, "tag":"Dog"}, {"score":0.8702095746994019, "tag":"Pet"}, {"score":0.8646901249885559, "tag":"Mammal"}, {"score":0.8270695209503174, "tag":"Animal"}, {"score":0.2900576591491699, "tag":"Snow"}, {"score":0.22053982317447662, "tag":"Winter"}, {"score":0.1604217290878296, "tag":"Dog breed"}, {"score":0.14872552454471588, "tag":"Carnivore"}, {"score":0.08632490038871765, "tag":"Puppy"}, {"score":0.07958601415157318, "tag":"Wildlife"}]}

>>> print( "\nPhrase Extractor" )
>>> print( paralleldots.phrase_extractor( text ) )
{"keywords":[{"relevance_score":3, "keyword":"Hyderabad Central University"}, {"relevance_score":2, "keyword":"Rohith Vemula"}, {"relevance_score":2, "keyword":"JNU row"}, {"relevance_score":6, "keyword":"Human Resource Development Minister Smriti Irani"}, {"relevance_score":2, "keyword":"Lok Sabha"}, {"relevance_score":4, "keyword":"Prime Minister Narendra Modi"}, {"relevance_score":2, "keyword":"Dalit scholar"}], "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"}

>>> print( "\nPopularity" )
>>> print( paralleldots.popularity( path ) )
{"Popular":"38.1271243095", "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "Not Popular":"61.8728756905"}

>>> print( "\nPopularity: URL Method" )
>>> print( paralleldots.popularity_url( url ) )
{"Popular":"68.9268052578", "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: https://www.paralleldots.com/terms-and-conditions", "Not Popular":"31.0731947422"}

>>> print( "\nSentiment" )
>>> print( paralleldots.sentiment( text ) )
{"probabilities":{"positive":0.266, "neutral":0.549, "negative":0.185}, "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "sentiment":"neutral"}

>>> print( "\nSentiment - Lang: Fr". )
>>> print( paralleldots.sentiment( lang_text, lang_code ) )
{"probabilities":{"positive":0.02, "neutral":0.291, "negative":0.689}, "usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "sentiment":"negative"}

>>> print( "\nSimilarity" )
>>> print( paralleldots.similarity( "I love fish and ice cream!", "fish and ice cream are the best!" ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "actual_score":0.848528, "normalized_score":4.936506}

>>> print( "\nTaxonomy" )
>>> print( paralleldots.taxonomy( text ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "taxonomy":[{"tag":"News and Politics/Law", "confidence_score":0.845402}, {"tag":"Hobbies & Interests/Workshops and Classes", "confidence_score":0.878964}, {"tag":"Business and Finance/Industries", "confidence_score":0.7353}]}

>>> print( "\nText Parser" )
>>> print( paralleldots.text_parser( text ) )
{"usage":"By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions", "output":[{"text":"Prime", "Dependency":"compound", "Tags":"noun"}, {"text":"Minister", "Dependency":"compound", "Tags":"noun"}, {"text":"Narendra", "Dependency":"compound", "Tags":"noun"}, {"text":"Modi", "Dependency":"nominal subject", "Tags":"noun"}, {"text":"tweeted", "Dependency":"root", "Tags":"verb"}, {"text":"a", "Dependency":"determiner", "Tags":"determiner"}, {"text":"link", "Dependency":"direct object", "Tags":"noun"}, {"text":"to", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"speech", "Dependency":"compound", "Tags":"noun"}, {"text":"Human", "Dependency":"compound", "Tags":"noun"}, {"text":"Resource", "Dependency":"compound", "Tags":"noun"}, {"text":"Development", "Dependency":"compound", "Tags":"noun"}, {"text":"Minister", "Dependency":"compound", "Tags":"noun"}, {"text":"Smriti", "Dependency":"compound", "Tags":"noun"}, {"text":"Irani", "Dependency":"object of a preposition", "Tags":"noun"}, {"text":"in", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"Lok", "Dependency":"compound", "Tags":"noun"}, {"text":"Sabha", "Dependency":"object of a preposition", "Tags":"noun"}, {"text":"during", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"debate", "Dependency":"object of a preposition", "Tags":"noun"}, {"text":"on", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"ongoing", "Dependency":"adjectival modifier", "Tags":"adjective"}, {"text":"JNU", "Dependency":"compound", "Tags":"noun"}, {"text":"row", "Dependency":"object of a preposition", "Tags":"noun"}, {"text":"and", "Dependency":"coordinating conjunction", "Tags":"conjuction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"suicide", "Dependency":"conjunct", "Tags":"noun"}, {"text":"of", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"Dalit", "Dependency":"compound", "Tags":"noun"}, {"text":"scholar", "Dependency":"compound", "Tags":"noun"}, {"text":"Rohith", "Dependency":"compound", "Tags":"noun"}, {"text":"Vemula", "Dependency":"object of a preposition", "Tags":"noun"}, {"text":"at", "Dependency":"prepositional modifier", "Tags":"preposition or conjunction"}, {"text":"the", "Dependency":"determiner", "Tags":"determiner"}, {"text":"Hyderabad", "Dependency":"compound", "Tags":"noun"}, {"text":"Central", "Dependency":"compound", "Tags":"noun"}, {"text":"University", "Dependency":"object of a preposition", "Tags":"noun"}]}

>>> paralleldots.usage()
{ "paying": False, "visual_monthly_quota": 100, "visual_daily_quota": 1000, "monthly_quota": 10000, "daily_quota": 1000, "excel_monthly_quota": 1000, "excel_daily_quota": 100 }

Project details


Download files

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

Source Distribution

ParallelDots-3.2.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

ParallelDots-3.2.1-py2.py3-none-any.whl (12.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ParallelDots-3.2.1.tar.gz.

File metadata

File hashes

Hashes for ParallelDots-3.2.1.tar.gz
Algorithm Hash digest
SHA256 9f2c1bd3c6f8c4fc5cddff31bcf05da4d40fea2f610eb01e7ffd3a8d0d497913
MD5 5877d83af5ecc5415d63afa63849ae33
BLAKE2b-256 46359e0267fb23338fbda40282e73c89db96f1154bab929a1bd14f4193523a40

See more details on using hashes here.

File details

Details for the file ParallelDots-3.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ParallelDots-3.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 237debd4f72a48a1d9f66f17865bda5d7e175b7ebca621b1762b89bd3449178c
MD5 33577a05ea341bb898428438229a8eeb
BLAKE2b-256 de53b93fdfefde757f81f9ea892d0b904382f8be2a340feafe75b4ca3ba98017

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page