mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-15 02:50:33 +03:00
added classy-classification package to spacy universe (#10393)
* Update universe.json added classy-classification to Spacy universe * Update universe.json added classy-classification to the spacy universe resources * Update universe.json corrected a small typo in json * Update website/meta/universe.json Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> * Update website/meta/universe.json Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> * Update website/meta/universe.json Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com> * Update universe.json processed merge feedback * Update universe.json Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
parent
56cb167e84
commit
98ebf50e84
|
@ -2599,6 +2599,53 @@
|
||||||
},
|
},
|
||||||
"category": ["pipeline"]
|
"category": ["pipeline"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "classyclassification",
|
||||||
|
"slogan": "A Python library for classy few-shot and zero-shot classification within spaCy.",
|
||||||
|
"description": "Huggingface does offer some nice models for few/zero-shot classification, but these are not tailored to multi-lingual approaches. Rasa NLU has a nice approach for this, but its too embedded in their codebase for easy usage outside of Rasa/chatbots. Additionally, it made sense to integrate sentence-transformers and Huggingface zero-shot, instead of default word embeddings. Finally, I decided to integrate with spaCy, since training a custom spaCy TextCategorizer seems like a lot of hassle if you want something quick and dirty.",
|
||||||
|
"github": "davidberenstein1957/classy-classification",
|
||||||
|
"pip": "classy-classification",
|
||||||
|
"code_example": [
|
||||||
|
"import spacy",
|
||||||
|
"import classy_classification",
|
||||||
|
"",
|
||||||
|
"data = {",
|
||||||
|
" \"furniture\": [\"This text is about chairs.\",",
|
||||||
|
" \"Couches, benches and televisions.\",",
|
||||||
|
" \"I really need to get a new sofa.\"],",
|
||||||
|
" \"kitchen\": [\"There also exist things like fridges.\",",
|
||||||
|
" \"I hope to be getting a new stove today.\",",
|
||||||
|
" \"Do you also have some ovens.\"]",
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
"nlp = spacy.load('en_core_web_md')",
|
||||||
|
"",
|
||||||
|
"classification_type = \"spacy_few_shot\"",
|
||||||
|
"if classification_type == \"spacy_few_shot\":",
|
||||||
|
" nlp.add_pipe(\"text_categorizer\", ",
|
||||||
|
" config={\"data\": data, \"model\": \"spacy\"}",
|
||||||
|
" )",
|
||||||
|
"elif classification_type == \"sentence_transformer_few_shot\":",
|
||||||
|
" nlp.add_pipe(\"text_categorizer\", ",
|
||||||
|
" config={\"data\": data, \"model\": \"sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2\"}",
|
||||||
|
" )",
|
||||||
|
"elif classification_type == \"huggingface_zero_shot\":",
|
||||||
|
" nlp.add_pipe(\"text_categorizer\", ",
|
||||||
|
" config={\"data\": list(data.keys()), \"cat_type\": \"zero\", \"model\": \"facebook/bart-large-mnli\"}",
|
||||||
|
" )",
|
||||||
|
"",
|
||||||
|
"print(nlp(\"I am looking for kitchen appliances.\")._.cats)",
|
||||||
|
"print([doc._.cats for doc in nlp.pipe([\"I am looking for kitchen appliances.\"])])"
|
||||||
|
],
|
||||||
|
"author": "David Berenstein",
|
||||||
|
"author_links": {
|
||||||
|
"github": "davidberenstein1957",
|
||||||
|
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
|
||||||
|
},
|
||||||
|
"category": ["pipeline", "standalone"],
|
||||||
|
"tags": ["classification", "zero-shot", "few-shot", "sentence-transformers", "huggingface"],
|
||||||
|
"spacy_version": 3
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "blackstone",
|
"id": "blackstone",
|
||||||
"title": "Blackstone",
|
"title": "Blackstone",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user