{"id":15520702,"url":"https://github.com/yash1994/spacy-go","last_synced_at":"2025-07-13T00:41:15.098Z","repository":{"id":57542666,"uuid":"274364286","full_name":"yash1994/spacy-go","owner":"yash1994","description":"Golang API for spaCy with Python gRPC","archived":false,"fork":false,"pushed_at":"2023-07-05T21:02:50.000Z","size":158,"stargazers_count":29,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T19:17:46.361Z","etag":null,"topics":["golang","grpc-go","python36","spacy-extension","spacy-nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yash1994.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T09:27:29.000Z","updated_at":"2024-09-09T15:06:57.000Z","dependencies_parsed_at":"2024-06-20T01:53:32.236Z","dependency_job_id":null,"html_url":"https://github.com/yash1994/spacy-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yash1994%2Fspacy-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yash1994%2Fspacy-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yash1994%2Fspacy-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yash1994%2Fspacy-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yash1994","download_url":"https://codeload.github.com/yash1994/spacy-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250366722,"owners_count":21418772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","grpc-go","python36","spacy-extension","spacy-nlp"],"created_at":"2024-10-02T10:28:52.485Z","updated_at":"2025-04-23T04:10:31.471Z","avatar_url":"https://github.com/yash1994.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spaCy-Go\n\n[![Build Status](https://travis-ci.org/yash1994/spacy-go.svg?branch=master)](https://travis-ci.org/yash1994/spacy-go)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/yash1994/spacy-go)\n[![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n[![codecov](https://codecov.io/gh/yash1994/spacy-go/branch/master/graph/badge.svg)](https://codecov.io/gh/yash1994/spacy-go)\n\nspacy-go is Golang interface for accessing linguistic annotations provided by\n[spaCy](https://spacy.io) using Google's [gRPC](https://grpc.io/). This module only supports basic functionalities like loading language models, linguistic annotation and similarity for text sentences.\n\n## Installation\n\n### Installing Golang library\n\nspacy-go Golang library can be installed by following single command.\n\n```bash\ngo get -v \"github.com/yash1994/spacy-go\"\n```\n\n### Setting up python gRPC server\n\nThe `$GOPATH` environment variable lists places for Go to look for Go Workspaces. By default, Go assumes our GOPATH location is at `$HOME/go`, where `$HOME` is the root directory of our user account on our computer.\n\nBefore importing the golang library, these commands need to be executed (inside source package) to spin up the python gRPC server.\n\n`pip install -r $GOPATH/src/github.com/yash1994/spacy-go/requirements.txt`\n\nInstall spacy [language models](https://spacy.io/models) with following command.\n\n`python3 -m spacy download en_core_web_sm`\n\nConnection between client and server is secured by TLS/SSL authentication. Use following command to generate unique pair of root certificate that is used to authenticate the server and private key that only the server has access to.\n\n`openssl req -newkey rsa:2048 -nodes -keyout $GOPATH/src/github.com/yash1994/spacy-go/server.key -x509 -days 365 -out $GOPATH/src/github.com/yash1994/spacy-go/server.crt -subj \"/CN=localhost\"`\n\nThe following command will spin up python gRPC server at `localhost:50051`.\n\n`python3 $GOPATH/src/github.com/yash1994/spacy-go/api/server.py \u0026`\n\n## Usage\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tspacygo \"github.com/yash1994/spacy-go\"\n)\n\nfunc main() {\n\n\t// load language model\n\tvar modelName string = \"en_core_web_sm\"\n\tr, err := spacygo.Load(modelName)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfmt.Printf(\"%v \\n\", r.GetMessage())\n\n\t// annotate text\n\tvar text string = \"I propose to consider the question, 'Can machines think?\"\n\n\tdoc, err := spacygo.Nlp(text)\n\n\t// print annotated info : part-of-speech\n\tfor i, token := range doc.GetTokens() {\n\t\tfmt.Printf(\"token %v '%v' part-of-speech tag: %v \\n\", i, token.GetText(), token.GetPos())\n\t}\n\n\t// calculate text similarity\n\tvar texta string = \"I like apples\"\n\tvar textb string = \"I like oranges\"\n\n\ttextSimilarity, err := spacygo.Similarity(texta, textb)\n\n\tfmt.Printf(\"text similarity between %v and %v is %v\", texta, textb, textSimilarity.GetSimilarity())\n}\n```\n\n## :dizzy: APIs\n\n| Function | Arguments | Return Type | Description |\n| -------- | --------- | ----------- | ----------- |\n| Load | modelName `string` | [`TextResponse`](docs/textResponse.md), `Error` | Load [spaCy's Language Models](https://spacy.io/usage/models) for text annotations. |\n| Nlp | text `string` | [`ParsedNLPRes`](docs/parsedNlpRes.md), `Error` | Annotate (parse, tag, ner) text using previously loaded model. |\n| Similarity | texta `string`, textb `string` | [`TextSimilarity`](docs/textSimilarity.md), `Error` | Computes semantic similarity between two sentences using loaded language model. |\n| PatternMatch | Array of rule `struct`, text `string` | [`Matches`](docs/patternMatches.md), `Error` | Match sequences of tokens, based on pattern rules. |\n\n## ToDos\n* [x] Extensive Test cases\n* [x] Error handling server side\n* [x] Add SSL and auth\n* [x] API Docs\n* [x] Similarity API\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyash1994%2Fspacy-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyash1994%2Fspacy-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyash1994%2Fspacy-go/lists"}