{"id":21319097,"url":"https://github.com/kongnet/openrarity","last_synced_at":"2025-10-13T23:02:31.730Z","repository":{"id":60063619,"uuid":"540857724","full_name":"kongnet/openrarity","owner":"kongnet","description":"openRerity core algorithm JS implementation","archived":false,"fork":false,"pushed_at":"2023-01-12T07:53:29.000Z","size":26,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T23:51:37.515Z","etag":null,"topics":["algorithm","js","openrarity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/kongnet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-09-24T14:32:27.000Z","updated_at":"2024-01-04T23:27:26.000Z","dependencies_parsed_at":"2023-02-09T10:45:55.318Z","dependency_job_id":null,"html_url":"https://github.com/kongnet/openrarity","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/kongnet%2Fopenrarity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongnet%2Fopenrarity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongnet%2Fopenrarity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongnet%2Fopenrarity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kongnet","download_url":"https://codeload.github.com/kongnet/openrarity/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225792497,"owners_count":17524966,"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":["algorithm","js","openrarity"],"created_at":"2024-11-21T19:34:01.452Z","updated_at":"2025-10-13T23:02:26.691Z","avatar_url":"https://github.com/kongnet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openrarity\r\n\r\nopenRerity core algorithm JS implementation\r\nuse sky personal js lib\r\n\r\n## 安装 Install\r\n\r\n```js\r\nnpm i openrarity\r\n```\r\n\r\n## 测试 Test\r\n\r\n```js\r\nnpm test\r\n// normal rank\r\n// same rank\r\n```\r\n\r\n## 基线测试 Benchmark\r\n\r\n```js\r\nnpm run benchmark\r\n/* gen Collection items: 100,000   Rarity calc time: 651 ms -- Mac M2\r\n\r\n  { v: 1.010524265698629, toeknId: 53076, rank: 1 },\r\n  { v: 1.009992300140172, toeknId: 10548, rank: 2 },\r\n  '.....',\r\n  { v: 0.9894947869513546, toeknId: 44396, rank: 100000 }\r\n*/\r\n\r\n```\r\n\r\n## 覆盖率 Coverage\r\n\r\n```js\r\nnpm run cov\r\n/*\r\n----------------|---------|----------|---------|---------|-------------------\r\nFile            | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\r\n----------------|---------|----------|---------|---------|-------------------\r\nAll files       |     100 |      100 |     100 |     100 |\r\n----------------|---------|----------|---------|---------|-------------------\r\n*/\r\n```\r\n\r\n## 测试用例 Test Case\r\n\r\n```js\r\nconst tokenScore = require('openrarity')\r\n\r\nlet metaData2 = [\r\n  {\r\n    trait1: 'value1',\r\n    trait2: 'value1',\r\n    trait3: 'value1'\r\n  },\r\n  {\r\n    trait1: 'value1',\r\n    trait2: 'value1',\r\n    trait3: 'value1'\r\n  },\r\n  {\r\n    trait1: 'value2',\r\n    trait2: 'value1',\r\n    trait3: 'value3'\r\n  },\r\n  {\r\n    trait1: 'value2',\r\n    trait2: 'value2',\r\n    trait3: 'value3'\r\n  },\r\n  {\r\n    trait1: 'value3 ',\r\n    trait2: 'value3',\r\n    trait3: 'value3'\r\n  }\r\n]\r\nlet r = tokenScore(metaData2)\r\n\r\n/*\r\n=\u003e\r\n  [\r\n    { v: 1.3926137488801251, toeknId: 4, rank: 1 },\r\n    { v: 1.1338031424711967, toeknId: 3, rank: 2 },\r\n    { v: 0.8749925360622679, toeknId: 0, rank: 3 },\r\n    { v: 0.8749925360622679, toeknId: 1, rank: 3 },\r\n    { v: 0.7235980365241422, toeknId: 2, rank: 4 }\r\n  ]\r\n*/\r\n```\r\n\r\n## 算法步骤 Algorithm Step\r\n\r\n- Generate trait value map without undefined(blank) trait\r\n- Generate undefined(blank) trait for every token\r\n- Generate trait value stats include traitEntropy\r\n- Generate token trait probability list\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkongnet%2Fopenrarity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkongnet%2Fopenrarity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkongnet%2Fopenrarity/lists"}