Python SDK for RxNLP's Text Mining and NLP APIs. Build intelligent data-driven applications with Sentence Clustering, Topics Extraction, Opinion Summarization, and more.
Python
Clone or download
Latest commit f91fde6 Feb 26, 2018
Permalink
Failed to load latest commit information.
pyrxnlp
.travis.yml
LICENSE
MANIFEST.in add some new files Feb 7, 2018
README.md Update README.md Feb 26, 2018
README.rst
_config.yml Set theme jekyll-theme-dinky Feb 16, 2018
automate.py
requirements.txt code changes to make integration simple Feb 6, 2018
setup.cfg add some new files Feb 7, 2018
setup.py changes for correct rst rendering Feb 8, 2018

README.md

PyRXNLP - Python SDK for RxNLP's Text Mining APIs

Build intelligent data-driven applications with minimal effort.

APIs

Getting Started:

  1. Install pyrxnlp
pip install pyrxnlp
  1. Get your API Key.

  2. Start coding. Here's an example of Clustering Sentences.

Replace your_api_key with an actual key.

   
   import os
   from pyrxnlp.api.cluster_sentences import ClusterSentences

   # replace this with your api key (see: http://www.rxnlp.com/api-key/)
   apikey = "your_api_key"

   # Cluster from a list of sentences
    list_of_sentences = [
        "the sky is so high",
        "the sky is blue",
        "fly high into the sky.",
        "the trees are really tall",
        "I love the trees",
        "trees make me happy",
        "the sun is shining really bright"]
    
    # initialize sentence clustering
    clustering = ClusterSentences (apikey)
    
    # generate clusters and print 
    clusters = clustering.cluster_from_list (list_of_sentences)
    if clusters is not None:
        print ("------------------------------")
        print ("Clusters from a list of sentences")
        print ("------------------------------")
        clustering.print_clusters (clusters)

You should see output similar to:

------------------------------
Clusters from a list of sentences
------------------------------
Cluster label:  ['sky']
Cluster scores:  6.571693476432014
Cluster sentences:  ['fly high into the sky.', 'the sky is so high', 'the sky is blue']
===
Cluster label:  ['tree']
Cluster scores:  6.571693476432014
Cluster sentences:  ['I love the trees', 'trees make me happy', 'the trees are really tall']
===
Cluster label:  ['sentences_with_no_cluster_membership']
Cluster scores:  0.0
Cluster sentences:  ['0006:the sun is shining really bright']
===

Code Examples & Tutorials

Contributing

Reporting issues

When reporting issues please use "Github Issues" and include as much detail as possible about your operating system, python version and API endpoint used if applicable. Whenever possible, please also include a brief, self-contained code example that demonstrates the problem. Visuals are appreciated!