{"id":18732665,"url":"https://github.com/krzjoa/salto","last_synced_at":"2025-11-13T13:30:18.212Z","repository":{"id":57690794,"uuid":"492589864","full_name":"krzjoa/salto","owner":"krzjoa","description":"Playing with embedding vectors","archived":false,"fork":false,"pushed_at":"2023-11-21T21:11:55.000Z","size":3605,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T22:16:28.896Z","etag":null,"topics":["nlp","python","visulaization","word-embeddings"],"latest_commit_sha":null,"homepage":"https://salto.readthedocs.io","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/krzjoa.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":"2022-05-15T19:57:00.000Z","updated_at":"2022-05-21T20:51:15.000Z","dependencies_parsed_at":"2024-11-07T15:07:09.912Z","dependency_job_id":"e2040cd5-e895-4cab-ab81-da58c9bbd531","html_url":"https://github.com/krzjoa/salto","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/krzjoa%2Fsalto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzjoa%2Fsalto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzjoa%2Fsalto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzjoa%2Fsalto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krzjoa","download_url":"https://codeload.github.com/krzjoa/salto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239605123,"owners_count":19666998,"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":["nlp","python","visulaization","word-embeddings"],"created_at":"2024-11-07T15:07:02.506Z","updated_at":"2025-11-13T13:30:18.158Z","avatar_url":"https://github.com/krzjoa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# salto \u003cimg src='img/salto-logo.png' align=\"right\" height=\"139\" /\u003e\n\n\u003e Playing with embedding vectors\n\n\n## Installation\n\nYou can install this library from *PyPI*\n\n```bash\npip install salto\n```\n\nor from the GitHub repo:\n \n```bash\npip install git+https://github.com/krzjoa/salto.git\n```\n\n## Motivation\n\nThe goal of the **salto** package is to explore embeddings and check, \nhow the distance between two points (vectors) can be interpreted.\nWe get two arbitrary selected points, such as embedding vectors for **ice** and **fire**\ndraw a straight line passing trough the both these points. Then, we treat the \nnewly created line as a new axis by projecting the rest of the points onto this line.\n\n \n\n\u003cimg src = \"https://raw.githubusercontent.com/krzjoa/salto/main/examples/plot_3.png\"\u003e\u003c/a\u003e\n\u003ccenter\u003e \u003ci\u003eDrawn using: \u003ca\u003ehttps://www.geogebra.org/m/JMMKv7cx\u003ca\u003e\u003c/i\u003e\n \nI named the package **salto**, which means *somersault* in many languages or simply *jump* in Romance languages like Italian, where this word originally comes from.\nIt's because the operation of changing space for me resembles a kind of acrobatics 😉.\n\n## Usage\n\n```python\nimport numpy as np\nimport spacy\nimport salto\n\nnlp = spacy.load('en_core_web_md')\n\nfire = nlp('fire')\nice = nlp('ice')\n\nice_fire_axis = salto.axis(ice.vector, fire.vector)\n\ncold = ['ice cream', 'polar', 'snow', 'winter', 'fridge', 'Antarctica']\nwarm = ['boiling water', 'tropical', 'sun', 'summer', 'oven', 'Africa']\n\ncold_vecs = [nlp(w).vector for w in cold]\nwarm_vecs = [nlp(w).vector for w in warm]\n\ncold_values = [ice_fire_axis(p) for p in cold_vecs]\nwarm_values = [ice_fire_axis(p) for p in warm_vecs]\n\nice_fire_axis.plot(\n        {'values': cold_values, 'labels': cold, 'color': 'tab:blue'},\n        {'values': warm_values, 'labels': warm, 'color': 'tab:red'},\n        poles = {'negative': {'label': 'ice', 'color': 'blue'}, \n                 'positive': {'label': 'fire', 'color': 'red'}}\n    )  \n```\n\u003cimg src = \"https://raw.githubusercontent.com/krzjoa/salto/main/examples/word-embedding_45_0.png\"\u003e\u003c/a\u003e\n\n## See also\n[scikit-spatial](https://github.com/ajhynes7/scikit-spatial) - Spatial objects and computations based on NumPy arrays.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzjoa%2Fsalto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrzjoa%2Fsalto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzjoa%2Fsalto/lists"}