{"id":13935771,"url":"https://github.com/kootenpv/spacy_api","last_synced_at":"2026-03-05T14:01:46.062Z","repository":{"id":57469507,"uuid":"85464606","full_name":"kootenpv/spacy_api","owner":"kootenpv","description":"Server/Client around Spacy to load spacy only once","archived":false,"fork":false,"pushed_at":"2018-01-17T11:27:51.000Z","size":38,"stargazers_count":46,"open_issues_count":2,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-29T16:10:12.882Z","etag":null,"topics":["api","machine-learning","nlp","spacy"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kootenpv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-19T09:31:11.000Z","updated_at":"2023-10-21T22:53:31.000Z","dependencies_parsed_at":"2022-09-16T03:51:10.935Z","dependency_job_id":null,"html_url":"https://github.com/kootenpv/spacy_api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kootenpv/spacy_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fspacy_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fspacy_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fspacy_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fspacy_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kootenpv","download_url":"https://codeload.github.com/kootenpv/spacy_api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kootenpv%2Fspacy_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30130030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T12:40:50.676Z","status":"ssl_error","status_checked_at":"2026-03-05T12:39:32.209Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","machine-learning","nlp","spacy"],"created_at":"2024-08-07T23:02:04.968Z","updated_at":"2026-03-05T14:01:46.023Z","avatar_url":"https://github.com/kootenpv.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## spacy_api\n\nHelps with loading models in a separate, dedicated process.\n\nCaching happens on unique arguments.\n\n#### Features\n\n- ✓ Serve models separately\n- ✓ Client- and Server-side caching\n- ✓ CLI interface\n\n### Install\n\nShould work with py2 and py3.\n\nAssumes you have installed `spacy`.\n\nInstall:\n\n    pip install spacy_api[all]\n\n### Example\n\nRun the server:\n\n    spacy serve\n\nThen open a python process and run code in the next section.\n\n#### Single document\n\n```python\nfrom spacy_api import Client\n\nspacy_client = Client() # default args host/port\n\ndoc = spacy_client.single(\"How are you\")\ndoc\n# [[How, are, you]]\n\n# iterate over sentences\nfor sentence in doc.sents:\n    for token in sentence:\n        print(token.text, token.pos_, token.lemma_)\n\n# iterate over a whole document\nfor token in doc:\n    print(token)\n```\n\n#### Switch to running spacy within the process\n\nInstead of\n\n    from spacy_api import Client\n\nuse\n\n    from spacy_api import LocalClient\n\n#### Arguments\n\nLocalClient/Client:\n\n```python\n# language/model\nspacy_client = Client(model=\"en\")\n\n# Using google pretrained vectors\nspacy_client = Client(embeddings_path=\"en_google\")\n```\n\nTo make a call:\n\n```python\n# Tell spacy which attributes to give back, comma separated\nspacy_client.single(\"How are you\", attributes=\"text,lemma_,pos,vector\")\n```\n\nNaturally, you can use any combination of these.\n\n#### Bulk of documents\n\n```python\ndocs = spacy_client.bulk([\"How are you\"]*100)\nfor doc in docs:\n    for sentence in doc.sents:\n        for token in sentence:\n            print(token.text, token.pos_, token.lemma_)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkootenpv%2Fspacy_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkootenpv%2Fspacy_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkootenpv%2Fspacy_api/lists"}