Skip to main content

spaCy wrapper for Diffbot Natural Language API

Project description

spaCy wrapper for Diffbot Natural Language API

Extracts entities (e.g., people, organizations, locations) and facts about these entities from natural language text using Diffbot's natural language api (https://diffbot.com/products/natural-language/)

Installation

pip install spacy-diffbot-nlapi

Usage

import spacy
import spacy_diffbot_nlapi

nlp = spacy.blank("en")
nlp.add_pipe("diffbot", config={"token":DIFFBOT_TOKEN, "lang":"en", "concurrent_connections":10})

texts = [
    "Mike Tung is the founder and CEO of Diffbot. He is also an adviser at the StartX accelerator, and the leader of Stanford's entry in the DARPA Robotics Challenge. In a previous life, he was a grad student in the Stanford AI Lab, and a software engineer at eBay, Yahoo, and Microsoft. Tung studied electrical engineering and computer science at UC Berkeley and artificial intelligence at Stanford.",
    "Apple Inc. is an American multinational technology company headquartered in Cupertino, California, that designs, develops, and sells consumer electronics, computer software, and online services.",
    "Facebook (FB) said Friday that it had acquired Giphy, a popular search engine for short, looping videos and animations called GIFs. The service will become part of Facebook's Instagram team, making it easier for people to find relevant GIFs for their Stories and direct messages.",
]

for doc in nlp.pipe(texts):
    print(doc)
    for ent in doc.ents:
        print(f'{ent.text:>25}\t\t{ent.label_:>15}\t{ent.kb_id_:>25}\t{ent._.uris}')

Learn more

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

spacy-diffbot-nlapi-1.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

spacy_diffbot_nlapi-1.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file spacy-diffbot-nlapi-1.1.0.tar.gz.

File metadata

  • Download URL: spacy-diffbot-nlapi-1.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13

File hashes

Hashes for spacy-diffbot-nlapi-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bd68e1fb9e77ec199c18e322eb0a68e08689adaa74396dd57cd8f53c3890c94c
MD5 63f145867cc4af57c4b05b8149d63f1d
BLAKE2b-256 be2caa47dd971fc15e137c388df6cf45bf95c36f24e070e55ecb9e20b68d0ea5

See more details on using hashes here.

File details

Details for the file spacy_diffbot_nlapi-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: spacy_diffbot_nlapi-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13

File hashes

Hashes for spacy_diffbot_nlapi-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54815172e0c5fd1601aa8c8d8c6b51f5a67bd5e7db3d9e771df8f82f4196081b
MD5 ac0725f394c5cc7c8fcbcc847a1a21cb
BLAKE2b-256 7e0dd9173e341685c8cbbb28d503cbb98720fff569bdce5cef99e7797746cf2a

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