{"id":20238564,"url":"https://github.com/cadmiumcr/glove","last_synced_at":"2025-10-27T00:46:13.898Z","repository":{"id":91428135,"uuid":"192480194","full_name":"cadmiumcr/glove","owner":"cadmiumcr","description":"Pure Crystal implementation of Global Vectors for Word Representation (GloVe)","archived":false,"fork":false,"pushed_at":"2019-08-27T21:22:12.000Z","size":365,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T17:13:39.398Z","etag":null,"topics":["cadmium","crystal","global-vectors","glove","machine-learning","ml","natural-language-processing","nlp","word-embeddings"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/cadmiumcr.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":"2019-06-18T06:34:33.000Z","updated_at":"2019-08-28T03:11:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e09961e-a0a5-4b1c-a9aa-3db35c3873f8","html_url":"https://github.com/cadmiumcr/glove","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/cadmiumcr%2Fglove","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadmiumcr%2Fglove/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadmiumcr%2Fglove/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cadmiumcr%2Fglove/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cadmiumcr","download_url":"https://codeload.github.com/cadmiumcr/glove/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281423,"owners_count":21077423,"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":["cadmium","crystal","global-vectors","glove","machine-learning","ml","natural-language-processing","nlp","word-embeddings"],"created_at":"2024-11-14T08:34:46.831Z","updated_at":"2025-10-27T00:46:08.859Z","avatar_url":"https://github.com/cadmiumcr.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cadmium::Glove\n\nPure Crystal implementation of Global Vectors for Word Representations.\n\n\u003e Note that this does not work quite right yet. Something is off with the math and it's returning incorrect results.\n\n# Overview\n\nGloVe is an unsupervised learning algorithm for obtaining vector representations for words. Training is performed on aggregated global word-word co-occurrence statistics from a corpus, and the resulting representations showcase interesting linear substructures of the word vector space.\n\n# Resources\n\n- [Documentation](http://www.rubydoc.info/github/vesselinv/glove)\n- [Academic Paper on Global Vectors](http://nlp.stanford.edu/projects/glove/glove.pdf)\n- [Original C Implementation](http://nlp.stanford.edu/projects/glove/)\n\n#### Implementations in other languages\n\n- [ruby](https://github.com/vesselinv/glove)\n- [python](https://github.com/maciejkula/glove-python)\n- [scala](https://github.com/petro-rudenko/spark-glove)\n\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     cadmium_glove:\n       github: cadmium_cr/glove\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"cadmium\"\nrequire \"cadmium_glove\"\n\ninclude Cadmium\n\n# Create a new model. Values used here are the defaults.\nmodel = Glove::Model.new(\n  max_count: 100,\n  learning_rate: 0.05,\n  alpha: 0.75,\n  num_components: 30,\n  epochs: 5\n)\n\n# Feed the model some text\ntext = File.read(\"quantum-physics.txt\")\nmodel.fit(text)\n\n# Alternatively you can pass the model a Corpus object\ncorpus = Glove::Corpus.build(text)\nmodel.fit(corpus)\n\n# Train the model\nmodel.train\n\n# Save the model as JSON\nmodel.save(\"./data\")\n```\n\nTo import and use a model:\n\n```crystal\n# Load the previously saved model from the data directory\nmodel = Glove::Model.load(\"./data\")\n\n# Get the most similar words\nputs model.most_similar(\"quantum\")\n# =\u003e [[\"physics\", 0.9974459436353388], [\"mechanics\", 0.9971606266531394], [\"theory\", 0.9965966776283189]]\n\n# Find words that are releated to atom like quantum is related to physics\nputs model.analogy_words(\"atom\", \"quantum\", \"physics\")\n# =\u003e [[\"electron\", 0.9858380292886947], [\"energie\", 0.9815122410243475], [\"photon\", 0.9665073849076669]]\n```\n\n## Performance\n\nTODO: Benchmarks\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/cadmiumcr/glove/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Chris Watson](https://github.com/watzon) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadmiumcr%2Fglove","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcadmiumcr%2Fglove","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcadmiumcr%2Fglove/lists"}