Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diffbot/spacy-diffbot-nlapi
spaCy wrapper for Diffbot Natural Language API
https://github.com/diffbot/spacy-diffbot-nlapi
Last synced: 14 days ago
JSON representation
spaCy wrapper for Diffbot Natural Language API
- Host: GitHub
- URL: https://github.com/diffbot/spacy-diffbot-nlapi
- Owner: diffbot
- License: mit
- Created: 2021-05-25T16:55:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-09T20:37:04.000Z (over 3 years ago)
- Last Synced: 2025-02-03T11:04:21.957Z (18 days ago)
- Language: Python
- Size: 8.79 KB
- Stars: 2
- Watchers: 11
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```bash
pip install spacy-diffbot-nlapi
```## Usage
```python
import spacy
import spacy_diffbot_nlapinlp = 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
- [Documentation](https://docs.diffbot.com/docs/en/nl-index)
- [Demo](https://demo.nl.diffbot.com)