Python Wrapper for ParallelDots APIs
Project description
A wrapper for the ParallelDots API.
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. 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()
Supported APIs:
Abuse
Custom Classifier
Emotion ( Supports all ISO 639-1 Languages via their language code )
Intent
Keywords
Multilanguage Keywords ( Supports Multiple Languages )
Named Entity Extraction/Recognition ( NER )
Not Safe For Work ( NSFW Image Classifier )
Phrase Extractor
Popularity ( Image Classifier )
Sentiment Analysis ( Supports all ISO 639-1 Languages via their language code )
Semantic Similarity
Taxonomy
Text Parser
Usage
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 debate 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" ] } >>> paralleldots.set_api_key( api_key ) >>> print( "API Key: %s" % paralleldots.get_api_key() ) >>> print( "\nAbuse" ) >>> print( paralleldots.abuse( text ) ) {'confidence_score': 0.876953, 'sentence_type': 'Non Abusive', '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( "\nCustom Classifier" ) >>> print( paralleldots.custom_classifier( text, category ) ) {'taxonomy': [{'confidence_score': 0.737156, 'tag': 'india'}, {'confidence_score': 0.580833, 'tag': 'world politics'}, {'confidence_score': 0.259185, 'tag': 'finance'}], '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" ) >>> print( paralleldots.emotion( 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', 'emotion': 'happy', 'probabilities': {'indifferent': 0.307, 'sad': 0.071, 'angry': 0.05, 'happy': 0.449, 'excited': 0.123}} >>> print( "\nEmotion - Lang: Fr" ) >>> print( paralleldots.emotion( lang_text, lang_code ) ) {'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', 'emotion': 'sad', 'probabilities': {'indifferent': 0.229, 'sad': 0.364, 'angry': 0.349, 'happy': 0.049, 'excited': 0.009}} >>> print( "\nIntent" ) >>> print( paralleldots.intent( text ) ) {'intent': 'news', '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', 'probabilities': {'query': 0.004, 'marketing': 0.042, 'spam/junk': 0.003, 'feedback/opinion': 0.024, 'news': 0.927}} >>> print( "\nKeywords" ) >>> print( paralleldots.keywords( text ) ) {'keywords': [{'confidence_score': 0.857594, 'keyword': 'Prime Minister Narendra Modi'}, {'confidence_score': 0.913924, 'keyword': 'link'}, {'confidence_score': 0.70655, 'keyword': 'speech Human Resource'}, {'confidence_score': 0.860351, 'keyword': 'Smriti'}, {'confidence_score': 0.945534, 'keyword': 'Lok'}], '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( "\nMultilang Keywords - Lang: Fr" ) >>> print( paralleldots.multilang_keywords( lang_text, lang_code ) ) {'keywords': ['ici', 'hostile', 'attaqué', 'très', 'choisissez', 'si', 'cest', 'vicieusement', 'lopposition', 'débattre'], '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': [{'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': 'name'}, {'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': 'group'}, {'name': 'Hyderabad', 'confidence_score': 0.591985, 'category': 'place'}]} >>> print( "\nNSFW" ) >>> print( paralleldots.nsfw( path ) ) {'prob': 0.9995405673980713, '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'} >>> print( "\nPhrase Extractor" ) >>> print( paralleldots.phrase_extractor( text ) ) {'keywords': [{'relevance_score': 4, 'keyword': 'Prime Minister Narendra Modi'}, {'relevance_score': 6, 'keyword': 'Human Resource Development Minister Smriti Irani'}, {'relevance_score': 2, 'keyword': 'Lok Sabha'}, {'relevance_score': 1, 'keyword': 'ongoing'}, {'relevance_score': 2, 'keyword': 'JNU row'}, {'relevance_score': 2, 'keyword': 'Dalit scholar'}, {'relevance_score': 2, 'keyword': 'Rohith Vemula'}, {'relevance_score': 3, 'keyword': 'Hyderabad Central University'}], '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( "\nSentiment" ) >>> print( paralleldots.sentiment( 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', 'sentiment': 'neutral', 'probabilities': {'negative': 0.185, 'neutral': 0.549, 'positive': 0.266}} >>> print( "\nSentiment - Lang: Fr" ) >>> print( paralleldots.sentiment( lang_text, lang_code ) ) {'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', 'probabilities': {'negative': 0.689, 'neutral': 0.291, 'positive': 0.02}} >>> print( "\nSimilarity" ) >>> print( paralleldots.similarity( "I love fish and ice cream!", "fish and ice cream are the best!" ) ) {'normalized_score': 4.936506, 'actual_score': 0.848528, '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( "\nTaxonomy" ) >>> print( paralleldots.taxonomy( text ) ) {'taxonomy': [{'confidence_score': 0.845402, 'tag': 'News and Politics/Law'}, {'confidence_score': 0.878964, 'tag': 'Hobbies & Interests/Workshops and Classes'}, {'confidence_score': 0.7353, 'tag': 'Business and Finance/Industries'}], '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( "\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': [{'Tags': 'noun', 'text': 'Prime', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'Minister', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'Narendra', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'Modi', 'Dependency': 'nominal subject'}, {'Tags': 'verb', 'text': 'tweeted', 'Dependency': 'root'}, {'Tags': 'determiner', 'text': 'a', 'Dependency': 'determiner'}, {'Tags': 'noun', 'text': 'link', 'Dependency': 'direct object'}, {'Tags': 'preposition or conjunction', 'text': 'to', 'Dependency': 'prepositional modifier'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'noun', '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': 'preposition or conjunction', 'text': 'in', 'Dependency': 'prepositional modifier'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'noun', 'text': 'Lok', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'Sabha', 'Dependency': 'object of a preposition'}, {'Tags': 'preposition or conjunction', 'text': 'during', 'Dependency': 'prepositional modifier'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'noun', 'text': 'debate', 'Dependency': 'object of a preposition'}, {'Tags': 'preposition or conjunction', 'text': 'on', 'Dependency': 'prepositional modifier'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'adjective', 'text': 'ongoing', 'Dependency': 'adjectival modifier'}, {'Tags': 'noun', 'text': 'JNU', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'row', 'Dependency': 'object of a preposition'}, {'Tags': 'conjuction', 'text': 'and', 'Dependency': 'coordinating conjunction'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'noun', 'text': 'suicide', 'Dependency': 'conjunct'}, {'Tags': 'preposition or conjunction', 'text': 'of', 'Dependency': 'prepositional modifier'}, {'Tags': 'noun', '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': 'preposition or conjunction', 'text': 'at', 'Dependency': 'prepositional modifier'}, {'Tags': 'determiner', 'text': 'the', 'Dependency': 'determiner'}, {'Tags': 'noun', 'text': 'Hyderabad', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'Central', 'Dependency': 'compound'}, {'Tags': 'noun', 'text': 'University', 'Dependency': 'object of a preposition'}]} >>> usage() {'visual_monthly_quota': 954, 'daily_quota': 1000, 'paying': True, 'visual_daily_quota': 100, 'monthly_quota': 0.0}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ParallelDots-3.1.0.tar.gz
.
File metadata
- Download URL: ParallelDots-3.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b34bb2461f605613b6505356bc79b24cd93be4b0530604465cfab05e3563853d |
|
MD5 | 1998beb59b2e3270b1bf5e899c2938f4 |
|
BLAKE2b-256 | 8774620d46c6adfeb45d658260179500fdd23107b7b451f001ab87eba8725b57 |
File details
Details for the file ParallelDots-3.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: ParallelDots-3.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85cb85883aabdbbe46680bef26eee31280e93477569a38c677becc309d6fd3bc |
|
MD5 | f98911eda68101d49fe49b80ea2b7d72 |
|
BLAKE2b-256 | 24f304d7b045a2833b54076cb43fc79ce86ce6ddc63a8aca3b740c0055acf149 |