All Projects → inception-project → inception-external-recommender

inception-project / inception-external-recommender

Licence: Apache-2.0 license
Get annotation suggestions for the INCEpTION text annotation platform from spaCy, Sentence BERT, scikit-learn and more. Runs as a web-service compatible with the external recommender API of INCEpTION.

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects
Makefile
30231 projects

Projects that are alternatives of or similar to inception-external-recommender

Prodigy Recipes
🍳 Recipes for the Prodigy, our fully scriptable annotation tool
Stars: ✭ 229 (+536.11%)
Mutual labels:  annotation, spacy
Tageditor
🏖TagEditor - Annotation tool for spaCy
Stars: ✭ 92 (+155.56%)
Mutual labels:  annotation, spacy
SMMT
Social Media Mining Toolkit (SMMT) main repository
Stars: ✭ 116 (+222.22%)
Mutual labels:  annotation, spacy
Jupyterlab Prodigy
🧬 A JupyterLab extension for annotating data with Prodigy
Stars: ✭ 97 (+169.44%)
Mutual labels:  annotation, spacy
DrFAQ
DrFAQ is a plug-and-play question answering NLP chatbot that can be generally applied to any organisation's text corpora.
Stars: ✭ 29 (-19.44%)
Mutual labels:  spacy
Pcat open source
PointCloud Annotation Tools, support to label object bound box, ground, lane and kerb
Stars: ✭ 209 (+480.56%)
Mutual labels:  annotation
React Image Annotation
An infinitely customizable image annotation library built on React
Stars: ✭ 203 (+463.89%)
Mutual labels:  annotation
Genometools
GenomeTools genome analysis system.
Stars: ✭ 186 (+416.67%)
Mutual labels:  annotation
annotorious-openseadragon
An OpenSeadragon plugin for annotating high-res zoomable images
Stars: ✭ 93 (+158.33%)
Mutual labels:  annotation
time-series-annotator
Time series annotation library.
Stars: ✭ 52 (+44.44%)
Mutual labels:  annotation
Od Annotation
目标检测数据集标注工具
Stars: ✭ 253 (+602.78%)
Mutual labels:  annotation
Errant
ERRor ANnotation Toolkit: Automatically extract and classify grammatical errors in parallel original and corrected sentences.
Stars: ✭ 208 (+477.78%)
Mutual labels:  annotation
etos-deepcut
Deep Extreme Cut http://www.vision.ee.ethz.ch/~cvlsegmentation/dextr . a tool to do automatically object segmentation from extreme points.
Stars: ✭ 24 (-33.33%)
Mutual labels:  annotation
Dart Json Mapper
Serialize / Deserialize Dart Objects to / from JSON
Stars: ✭ 206 (+472.22%)
Mutual labels:  annotation
Semantic-Textual-Similarity
Natural Language Processing using NLTK and Spacy
Stars: ✭ 30 (-16.67%)
Mutual labels:  spacy
Grasp
A reliable org-capture browser extension for Chrome/Firefox
Stars: ✭ 193 (+436.11%)
Mutual labels:  annotation
Browser Extension
The Hypothesis browser extensions.
Stars: ✭ 246 (+583.33%)
Mutual labels:  annotation
prodigy-scratch
Prodigy thing(z)
Stars: ✭ 13 (-63.89%)
Mutual labels:  spacy
Silencer
Scala compiler plugin for warning suppression
Stars: ✭ 239 (+563.89%)
Mutual labels:  annotation
spacy-sentence-bert
Sentence transformers models for SpaCy
Stars: ✭ 88 (+144.44%)
Mutual labels:  spacy

inception-external-recommender

Code style: black

This repository provides ariadne, a library to run and implement external recommenders for INCEpTION using Python.

You can watch external recommender in action in the follwing video:

Alt text

Install required packages

For installing the required packages we provide a setup.py to simplify the process. To install the basic requirements just run

pip install -e .

There are further requirements which need to be fulfilled depending on the use case. They are listed and explained below:

  • contrib for being able to use the provided already usable external recommenders (for a detailed overview see Contrib Models below)
  • test for being able to use the tests
  • dev for being able to develop this package

To install for example the contrib dependencies run:

pip install -e ".[contrib]"

Starting a simple recommender

We provide multiple ready to use recommenders. A full overview of them can be found at Contrib Models.

In this section we provide an example on how to start a server with two recommenders, one for named entities and one for parts-of-speech. They both use spaCy and are not trainable.

Be aware that the english spacy model needs to be downloaded previously. This can be done by running:

python -m spacy download en_core_web_sm 

Then you can use this example code to start the server:

from ariadne.contrib.spacy import SpacyNerClassifier, SpacyPosClassifier
from ariadne.server import Server
  
server = Server()
server.add_classifier("spacy_ner", SpacyNerClassifier("en_core_web_sm"))
server.add_classifier("spacy_pos", SpacyPosClassifier("en_core_web_sm"))

server.start()

The external recommenders are afterwards reachable under http://localhost:5000/spacy_ner and http://localhost:5000/spacy_pos respectively.

To add them to your INCEpTION-project open its settings page and choose the tab Recommenders. Click on Create to create a new recommender. Then choose its properties according to the picture below to add the part-of-speech recommender. Its name is generated automatically.

Click Save and open a text for annotation. After performing an action, e.g. making an annotation, the recommendations are shown above the tokens. Adding the named-entity recommender works similarly. A detailed description for using a recommender can be found in the INCEpTION user guide.

Building your own recommender

See ariadne/contrib/sklearn.py for examples.

Deployment

In order to support multiple users at once, the recommender server needs to be started on a wsgi server. This can e.g. be done via gunicorn. We provide an example in wsgi.py which can be run on gunicorn via

gunicorn -w 4 -b 127.0.0.1:5000 wsgi:app

This runs the recommendation server with 4 workers, that means at least 4 users can use the server at the same time. Make sure to scale this to your needs. Also adjust the IP adress the server is listening on. 0.0.0.0 exposes it to your network!

Contrib Models

Multiple different models have already been implemented and are ready for you to use. The following table provides an overview about them:

Classname Description Trainable
JiebaSegmenter Chinese segmentation prediction with Jieba no
LevenshteinStringMatcher "Fuzzy" string matching yes
NltkStemmer Word stemming prediction with NLTK, using its PorterStemmer no
SklearnMentionDetector Mention detection with sklearn-crfsuite, using a conditional random field, trained with gradient descent using the L-BFGS method yes
SklearnSentenceClassifier Sentence classification with scikit-learn, using its multinominal naive bayes classifier and TF-IDF counts as features yes
SpacyNerClassifier Named-entity prediction with spaCy no
SpacyPosClassifier Part-of-speech prediction with spaCy no
AdapterSequenceTagger Sequence tagger using Adapters no
AdapterSentenceClassifier Sentence classifier using Adapters no

For using trainable recommenders it is important to check the checkbox Trainable when adding the external recommender to your project. To be able to get predictions of a added trainable recommenders you need to start creating annotations in the corresponding layer. Afterwards click on the speechbubble-symbol (Recommendation) on the left side and choose Save to train the recommender. Now new predictions will be displayed.

The contrib models are an example and are intended to be used with INCEpTION, therefore they might not be a 100% fit for you, e.g. create_prediction. If your project uses a different type system than DKPro, then you can alter the variables in inception_util.py.

Jieba Segmenter

This recommender uses Jieba for predicting Chinese segmentation.

S-BERT sentence classifier

This recommender uses S-BERT together with LightGBM for sentence classification.

Development

The following section describes how to develop your own recommender. inception-recommender comes with example requests which can be found in examples/requests.

Tester

The tester allows to send different requests to your external recommender, thereby you do not need to run INCEpTION during (early) development.

$ python scripts/tester.py train -h
usage: tester.py [-h] [-u USER] {train,predict}

Test your INCEpTION external recommender.

positional arguments:
  {train,predict}       The request type you want to use.

optional arguments:
  -h, --help            show this help message and exit
  -u USER, --user USER  The user issuing the request.

Developing in deployment setting

The simplest way to develop in deployment setting, that is using gunicorn is to just run

make gunicorn

This starts gunicorn with 4 workers and hot-code reloading.

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].