All Projects β†’ ines β†’ Spacy Graphql

ines / Spacy Graphql

Licence: mit
πŸ€Ήβ€β™€οΈ Query spaCy's linguistic annotations using GraphQL

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Spacy Graphql

Projects
πŸͺ End-to-end NLP workflows from prototype to production
Stars: ✭ 397 (+390.12%)
Mutual labels:  natural-language-processing, spacy
Spacy Transformers
πŸ›Έ Use pretrained transformers like BERT, XLNet and GPT-2 in spaCy
Stars: ✭ 919 (+1034.57%)
Mutual labels:  natural-language-processing, spacy
Spacy
πŸ’« Industrial-strength Natural Language Processing (NLP) in Python
Stars: ✭ 21,978 (+27033.33%)
Mutual labels:  natural-language-processing, spacy
Responder
A familiar HTTP Service Framework for Python.
Stars: ✭ 3,569 (+4306.17%)
Mutual labels:  graphql, flask
Graphql Server
This is the core package for using GraphQL in a custom server easily
Stars: ✭ 65 (-19.75%)
Mutual labels:  graphql, flask
Spacy Streamlit
πŸ‘‘ spaCy building blocks and visualizers for Streamlit apps
Stars: ✭ 360 (+344.44%)
Mutual labels:  natural-language-processing, spacy
Spacy Models
πŸ’« Models for the spaCy Natural Language Processing (NLP) library
Stars: ✭ 796 (+882.72%)
Mutual labels:  natural-language-processing, spacy
Flask Graphene Sqlalchemy
A demo project for Flask + GraphQL (With Graphene & SQLAlchemy)
Stars: ✭ 117 (+44.44%)
Mutual labels:  graphql, flask
Text Analytics With Python
Learn how to process, classify, cluster, summarize, understand syntax, semantics and sentiment of text data with the power of Python! This repository contains code and datasets used in my book, "Text Analytics with Python" published by Apress/Springer.
Stars: ✭ 1,132 (+1297.53%)
Mutual labels:  natural-language-processing, spacy
Best Of Web Python
πŸ† A ranked list of awesome python libraries for web development. Updated weekly.
Stars: ✭ 1,118 (+1280.25%)
Mutual labels:  graphql, flask
Adam qas
ADAM - A Question Answering System. Inspired from IBM Watson
Stars: ✭ 330 (+307.41%)
Mutual labels:  natural-language-processing, spacy
Python nlp tutorial
This repository provides everything to get started with Python for Text Mining / Natural Language Processing (NLP)
Stars: ✭ 72 (-11.11%)
Mutual labels:  natural-language-processing, spacy
Displacy
πŸ’₯ displaCy.js: An open-source NLP visualiser for the modern web
Stars: ✭ 311 (+283.95%)
Mutual labels:  natural-language-processing, spacy
Nlp Python Deep Learning
NLP in Python with Deep Learning
Stars: ✭ 374 (+361.73%)
Mutual labels:  natural-language-processing, spacy
Medacy
πŸ₯ Medical Text Mining and Information Extraction with spaCy
Stars: ✭ 287 (+254.32%)
Mutual labels:  natural-language-processing, spacy
Spacy Stanza
πŸ’₯ Use the latest Stanza (StanfordNLP) research models directly in spaCy
Stars: ✭ 508 (+527.16%)
Mutual labels:  natural-language-processing, spacy
Delbot
It understands your voice commands, searches news and knowledge sources, and summarizes and reads out content to you.
Stars: ✭ 191 (+135.8%)
Mutual labels:  flask, natural-language-processing
Flask Graphene Sqlalchemy
βš—οΈProject template to build a GraphQL API in Python
Stars: ✭ 109 (+34.57%)
Mutual labels:  graphql, flask
Spacy Lookups Data
πŸ“‚ Additional lookup tables and data resources for spaCy
Stars: ✭ 48 (-40.74%)
Mutual labels:  natural-language-processing, spacy
Sense2vec
πŸ¦† Contextually-keyed word vectors
Stars: ✭ 1,184 (+1361.73%)
Mutual labels:  natural-language-processing, spacy

spacy-graphql

A very simple and experimental app that lets you query spaCy's linguistic annotations using GraphQL. It's my first ever experiment with GraphQL, so it's probably not as elegant as it could be.

The API currently supports most token attributes, named entities, sentences and text categories (if available as doc.cats, i.e. if you added a text classifier to a model). The meta field will return the model meta data. Models are only loaded once and kept in memory.

It currently doesn't do anything particularly clever, so regardless of your query, the full model pipeline will always be applied, even if you only need the token texts. Similarly, if you only request entities, the document will still be tagged and parsed.

Installation & Usage

To try it out, clone this repo and install the dependencies. By default, the en_core_web_sm model will be preinstalled. Note that the API requires Python 3.5 or higher.

git clone https://github.com/ines/spacy-graphql
cd spacy-graphql
pip install -r requirements.txt
# optional: install more spaCy models

Executing the app.py will start the server:

python app.py

You can use the SPACY_HOST and SPACY_PORT environment variables to change the host and port. By default, the API is served on localhost:8080.

If you navigate to the URL in your browser, you can explore the API interactively using GraphiQL. It also shows the complete documentation for the available fields.

GraphiQL

Example query

Both the text and model argument are required. The value of model is passed to spacy.load, so you'll be able to load any model that's installed in the same environment out-of-the-box.

{
  nlp(text: "Zuckerberg is the CEO of Facebook.", model: "en_core_web_sm") {
    meta {
      lang
      description
    }
    doc {
      text
      tokens {
        text
        pos_
      }
      ents {
        text
        label_
      }
    }
  }
}

Example Response

{
  "data": {
    "nlp": {
      "meta": {
        "lang": "en",
        "description": "English multi-task CNN trained on OntoNotes, with GloVe vectors trained on Common Crawl. Assigns word vectors, context-specific token vectors, POS tags, dependency parse and named entities."
      },
      "doc": {
        "text": "Zuckerberg is the CEO of Facebook.",
        "tokens": [
          {
            "text": "Zuckerberg",
            "pos_": "PROPN"
          },
          {
            "text": "is",
            "pos_": "VERB"
          },
          {
            "text": "the",
            "pos_": "DET"
          },
          {
            "text": "CEO",
            "pos_": "NOUN"
          },
          {
            "text": "of",
            "pos_": "ADP"
          },
          {
            "text": "Facebook",
            "pos_": "PROPN"
          },
          {
            "text": ".",
            "pos_": "PUNCT"
          }
        ],
        "ents": [
          {
            "text": "Zuckerberg",
            "label_": "PERSON"
          },
          {
            "text": "Facebook",
            "label_": "ORG"
          }
        ]
      }
    }
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].