{"id":39081716,"url":"https://github.com/lovit/fastcosine","last_synced_at":"2026-01-17T18:30:56.781Z","repository":{"id":57428552,"uuid":"96062802","full_name":"lovit/fastcosine","owner":"lovit","description":"Approximiated nearest neighbor search for sparse vector","archived":false,"fork":false,"pushed_at":"2018-11-04T22:32:41.000Z","size":615,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T10:49:11.237Z","etag":null,"topics":[],"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/lovit.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-07-03T02:27:59.000Z","updated_at":"2021-05-31T04:04:13.000Z","dependencies_parsed_at":"2022-09-02T15:32:03.638Z","dependency_job_id":null,"html_url":"https://github.com/lovit/fastcosine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lovit/fastcosine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovit%2Ffastcosine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovit%2Ffastcosine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovit%2Ffastcosine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovit%2Ffastcosine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lovit","download_url":"https://codeload.github.com/lovit/fastcosine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lovit%2Ffastcosine/sbom","scorecard":{"id":600228,"data":{"date":"2025-08-11","repo":{"name":"github.com/lovit/fastcosine","commit":"2af1f19123366d76559313c79c078cf3b320be10"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T00:13:27.001Z","repository_id":57428552,"created_at":"2025-08-21T00:13:27.001Z","updated_at":"2025-08-21T00:13:27.001Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28515735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:28:00.501Z","status":"ssl_error","status_checked_at":"2026-01-17T18:28:00.150Z","response_time":85,"last_error":"SSL_read: 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":[],"created_at":"2026-01-17T18:30:55.820Z","updated_at":"2026-01-17T18:30:56.471Z","avatar_url":"https://github.com/lovit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastCosine\n\nFastCosine은 sparse vector로 표현되는 데이터에 대하여 최인접이웃을 근사적으로 빠르게 찾기 위한 인덱서로, inverted index를 기반으로 만들어졌습니다. \n\nApproximated nearest neighbor search indexer for sparse vector. It is based on inverted index\n\n## Setup\n\n    pip install fastcosine\n\n## Usage\n\nSet your input mm file path and model prefix\n\n```python\nfrom fastcosine import FastCosine\n\nmm_file = ''      # Fill your file\nmodel_prefix = '' # Fill your file\n```\n\nInsert mm file path for indexing\n\n```python\nfast_cosine = FastCosine()\nfast_cosine.indexing(mm_file)\n```\n\nSave indexed model\n\n```python\nfast_cosine.save(model_prefix)\n```\n\nIf you want to load indexed model, use load\n\n```python\nloaded_fast_cosine = FastCosine()\nloaded_fast_cosine.load(model_prefix)\n```\n\nFormat of query vector is dict.\n\n```python\nquery={1:0.3, 10:0.2, 783:0.1, 3322:0.1}\nquery = {t:v/sum(query.values()) for t,v in query.items()}\n\nneighbors, info = fast_cosine.kneighbors(\n    query, compute_true_cosine=True,\n    remain_tfidf_threshold=0.2,\n    max_weight_factor=0.2,\n    scoring_by_adding=False\n)\n```\n\nForm of `neighbors` is list of tuple; [(idx, cosine similarity), ... ]\n\n```python\nfrom pprint import pprint\npprint(neighbors)\n```\n\n    [(3142770, 0.6991051639009617),\n     (13749445, 0.6991051639009617),\n     (10270855, 0.6991051639009617),\n     (1290238, 0.5899354514246596),\n     (10783376, 0.4943420021569027),\n     (7734529, 0.4943420021569027),\n     (10305110, 0.4943420021569027),\n     (9504266, 0.4943420021569027),\n     (4070535, 0.4943420021569027),\n     (10239565, 0.4943420021569027)]\n\nProcessing details are described in `info`\n\n```python\npprint(info)\n```\n\n    {'calculated_percentage': 1.0,\n     'n_candidate': 121,\n     'n_computation': 121,\n     'n_considered_terms': 4,\n     'n_terms_in_query': 4,\n     'time [mil.sec]': {\n             'check_query_type': 0.016689300537109375,\n             'order_search_term': 0.009298324584960938,\n             'retrieval_similars': 0.13256072998046875,\n             'true_cosine_computation': 0.031232833862304688,\n             'whole_querying_process': 0.18978118896484375\n         }\n    }\n\n## Requires\n\n- nothing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovit%2Ffastcosine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flovit%2Ffastcosine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flovit%2Ffastcosine/lists"}