{"library":"spacy-legacy","code":"import spacy\nimport os\nfrom spacy.util import load_config_from_str\n\n# This config uses 'spacy.Tok2Vec.v1', an architecture moved to spacy-legacy\nconfig_content = \"\"\"\n[paths]\nvocab = null # Essential if not using pre-trained vectors, otherwise spacy might expect them\n\n[nlp]\nlang = \"en\"\npipeline = [\"tok2vec\"]\n\n[components]\n[components.tok2vec]\nfactory = \"tok2vec\"\n\n[components.tok2vec.model]\n@architectures = \"spacy.Tok2Vec.v1\"\nwidth = 96\nembed_size = 2000\n\"\"\"\n\n# Save config to a temporary file\nconfig_path = \"temp_legacy_config.cfg\"\nwith open(config_path, \"w\") as f:\n    f.write(config_content)\n\ntry:\n    # spaCy will automatically resolve 'spacy.Tok2Vec.v1' to spacy-legacy's implementation\n    print(f\"Attempting to load pipeline using config from {config_path}...\")\n    nlp = spacy.load(config_path)\n    print(\"Pipeline loaded successfully, leveraging spacy-legacy for 'Tok2Vec.v1'.\")\n\n    doc = nlp(\"This is a demonstration of spacy-legacy in action.\")\n    print(f\"Processed text: {doc.text}\")\n    print(f\"Number of tokens: {len(doc)}\")\n\nexcept Exception as e:\n    print(f\"An error occurred while loading the pipeline: {e}\")\n    print(\"Ensure spacy and spacy-legacy are installed. If spaCy's core architecture\")\n    print(\"for Tok2Vec.v1 has completely changed its signature, this example might need adjustment.\")\nfinally:\n    if os.path.exists(config_path):\n        os.remove(config_path)\n","lang":"python","description":"This quickstart demonstrates how `spacy-legacy` allows spaCy to load configurations that refer to older, deprecated component architectures. When `spaCy` encounters `@architectures = \"spacy.Tok2Vec.v1\"` in a config, and `v1` is no longer in the core library, `spacy-legacy` provides the necessary implementation, ensuring the pipeline loads without error.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}