<jupyter_start><jupyter_text>INCEpTION External Recommender Tutorial 🤖💬Welcome to the INCEpTION external recommender tutorial! 👋 It will show you how to set up external recommenders which can then be used in INCEpTION.  ⚠️ Please keep in mind, that this notebook is only for showing you how to use the external recommenders and *should not be used in production*. ⚠️  Prerequisites 🏗Before being able to use the external recommenders, we need to install the required packages and download the english spacy-models in the currently used kernel:<jupyter_code>import sys
!{sys.executable} -m pip install -e .[contrib]
!{sys.executable} -m spacy download en_core_web_sm<jupyter_output><empty_output><jupyter_text>Import Ariadne Server 🗄️First start with importing the server-class of [ariadne](https://inception.fandom.com/wiki/Ariadne) 🔗, a library to run and implement external recommenders for INCEpTION using Python.<jupyter_code>from ariadne.server import Server<jupyter_output><empty_output><jupyter_text>Import Contrib Recommenders 🗄️💡 We provide multiple ready to use recommenders. A full overview of them can be found on [GitHub](https://github.com/inception-project/inception-external-recommendercontrib-models) 🔗. In this tutorial we will 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. To be able to use them we need to import both of them from ariadne's contrib-module:<jupyter_code>from ariadne.contrib.spacy import SpacyNerClassifier, SpacyPosClassifier<jupyter_output><empty_output><jupyter_text>Create a Server and Add the Classifiers to it  🤖Now we can create a server and add our classifiers. Therefore we need to provide a name and an initialized Classifier-object for each recommender we want to add.<jupyter_code>server = Server()
server.add_classifier("ner", SpacyNerClassifier("en_core_web_sm"))
server.add_classifier("pos", SpacyPosClassifier("en_core_web_sm"))<jupyter_output><empty_output><jupyter_text>Start the server ⏯If all classifer which we want to use are added, we can start the server.**⚠️ Attention**: If you changed the code in this jupyter notebook and want to **restart the server 🔁**, it is neccessary to restart the whole kernel (Kernel -> Restart and run all). ⚠️<jupyter_code>server.start()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07371524852569503, 'fraction_numerical': 0.0, 'mean_word_length': 6.132132132132132, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '318802', 'license': 'Apache-2.0', 'n_tokens_mistral': 741, 'n_tokens_neox': 726, 'n_words': 283, 'path': 'Tutorial.ipynb', 'repo_name': 'mobashgr/inception-external-recommender', 'size': '2374'}