{"id":22266283,"url":"https://github.com/vsm/vsm-dictionary","last_synced_at":"2025-03-25T14:22:27.371Z","repository":{"id":44177098,"uuid":"120460844","full_name":"vsm/vsm-dictionary","owner":"vsm","description":"VSM-dictionary interface specification, and parent class with shared code for subclasses","archived":false,"fork":false,"pushed_at":"2022-02-11T05:11:57.000Z","size":417,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T15:56:00.310Z","etag":null,"topics":["dictionary","identifiers","ontology-search","terms","vsm"],"latest_commit_sha":null,"homepage":"http://vsm.github.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vsm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-06T13:28:11.000Z","updated_at":"2020-11-18T13:14:49.000Z","dependencies_parsed_at":"2022-09-14T10:51:12.743Z","dependency_job_id":null,"html_url":"https://github.com/vsm/vsm-dictionary","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/vsm%2Fvsm-dictionary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsm%2Fvsm-dictionary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsm","download_url":"https://codeload.github.com/vsm/vsm-dictionary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245477124,"owners_count":20621774,"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":["dictionary","identifiers","ontology-search","terms","vsm"],"created_at":"2024-12-03T10:18:13.667Z","updated_at":"2025-03-25T14:22:27.336Z","avatar_url":"https://github.com/vsm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vsm-dictionary\n\n\u003cbr\u003e\n\n## Intro\n\n[VSM-sentences](http://scicura.org/vsm/vsm.html)\nare built from terms (=words or phrases) that are linked to semantic identifiers\n(=unique IDs that represent a concept with a definition).\n\nThese terms+IDs are typically stored on various 'dictionary' servers\nthat make them accessible through their own API.\n\n`vsm-dictionary` provides a standardized interface for communicating with\ndictionary webservers, in order to support VSM-sentence-building tools.\n(Tools such as [`vsm-autocomplete`](https://github.com/vsm/vsm-autocomplete),\nor more advanced components for searching, storing, and managing terms).\n\n`vsm-dictionary` is also designed to handle multiple 'sub-dictionaries',\nas well as multiple synonyms per term.  \nAnd it supports the representation of stylized terms,\ne.g. with italic or superscript parts, like \u003ci\u003eCa\u003csup\u003e2+\u003c/sup\u003e\u003c/i\u003e, and more.\n\n\u003cbr\u003e\n\n## Overview\n\n`vsm-dictionary` contains only:\n- a full [specification](Dictionary.spec.md)\n  for the above interface (for search, creating terms, etc);\n- a '`VsmDictionary`' parent-class implementation, which provides VSM-specific\n  and shared functionality that subclasses should use.\n\nThe real interface with a dictionary service is thus\n*implemented by subclasses of `VsmDictionary`*.\n\nCurrently there are at least two such implementations available:\n- [`vsm-dictionary-local`](https://github.com/vsm/vsm-dictionary-local):  \n  a full implementation of a local (in-memory, serverless) VsmDictionary.\n  - This module can be used as a fully functional placeholder that does not\n    depend on a third-party term-server, while developing new tools\n    that depend on a VsmDictionary.\n  - Or it could provide mock terms+ids while running\n    standalone demos of VSM-sentence building tools.\n  - The many automated tests in VsmDictionaryLocal can give inspiration\n    for testing future, webserver-linked subclasses.\n- [`vsm-dictionary-remote-demo`](https://github.com/vsm/vsm-dictionary-remote-demo):  \n  a bare-minimum demo-implementation of a VsmDictionary that connects to a\n  hypothetical server API.\n  - This module only serves as inspiration for developing real interfaces\n    to an online dictionary service.\n  - Still, it includes a live demo that connects to a real server API.\n\n\u003cbr\u003e\n\n## How to implement a VsmDictionary subclass\n\n\u003cbr\u003e\n\n### Specification\n\n\u0026bull; Any implementation of a VsmDictionary (which communicates with\na particular dictionary-webservice) must follow the interface specified in\u0026nbsp;\n----\u0026gt;\u0026nbsp;[Dictionary.spec.md](Dictionary.spec.md)\u0026nbsp;\u0026lt;----- .  \n\u0026bull; `VsmDictionary` is the parent class that all implementations must\n'`extends`' from.  \n\u0026bull; \u003cspan style=\"font-size: smaller;\"\u003e\n(Note: we simply use the name 'Dictionary' for VsmDictionary,\nin the spec \u0026amp; source code).\u003c/span\u003e  \n\n\n\u003cbr\u003e\n\n### Installation with NPM for Node.js:\n\n```\nmkdir vsm-dictionary-newwwww\ncd    vsm-dictionary-newwwww\nnpm init -y\n```\n```\nnpm install vsm-dictionary\n```\n\n\u003cbr\u003e\n\n### Template for a subclass, as a Node.js module:\n\n(See also [`VsmDictionaryLocal`](https://github.com/vsm/vsm-dictionary-local)\nand [`VsmDictionaryRemoteDemo`](https://github.com/vsm/vsm-dictionary-remote-demo)).\n\n\u003cbr\u003e\n\n```javascript\n// Import the parent class.\nconst VsmDictionary = require('vsm-dictionary');\n\n// Make subclass and export as Node.js module.\nmodule.exports = class VsmDictionaryNewww extends VsmDictionary {\n\n  constructor(options) {\n    // Must call the parent constructor first.\n    super(options);\n\n    // ...\n\n  }\n\n\n  // Methods for Create, Read, Update, Delete of terms, subdictionary-info\n  // objects, etc. (see spec).\n\n  // ...\n  // ...\n\n\n  getEntryMatchesForString(str, options, cb) {\n    var matches = [];\n\n    // ...\n\n    cb(null, { items: matches });\n  }\n\n}\n```\n\n\n\u003cdiv style=\"font-size: smaller;\"\u003e\n\n(If the above code is placed in a file named 'VsmDictionaryNewww.js',\nit can already be used in another file 'test.js':\n```javascript\nvar Dict = require('./VsmDictionaryNewww.js');\nvar dict = new Dict();\nconsole.dir(dict);\ndict.getMatchesForString('42', {}, (err, res) =\u003e console.dir(res));\n```\nby running: `node test.js`).\n\n\u003c/div\u003e\n\n\n\u003cbr\u003e\n\n## Tests\n\nRun `npm test`, which runs tests with Mocha.  \nRun `npm run testw`, which automatically reruns tests on any file change.\n\n\u003cbr\u003e\n\n## Demo\n\nSee [`vsm-dictionary-local`](https://github.com/vsm/vsm-dictionary-local)\nand [`vsm-dictionary-remote-demo`](https://github.com/vsm/vsm-dictionary-remote-demo)\nfor interactive demos of at least the string-search functionality.\n\n\u003cbr\u003e\n\n## License\n\nThis project is licensed under the AGPL license - see [LICENSE.md](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsm%2Fvsm-dictionary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsm%2Fvsm-dictionary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsm%2Fvsm-dictionary/lists"}