{"id":17046033,"url":"https://github.com/vzhong/vocab","last_synced_at":"2025-04-12T15:32:20.359Z","repository":{"id":57477526,"uuid":"88791778","full_name":"vzhong/vocab","owner":"vzhong","description":"Vocabulary objects for natural language processing","archived":false,"fork":false,"pushed_at":"2020-06-01T19:40:55.000Z","size":20,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T02:52:35.174Z","etag":null,"topics":["machine-learning","nlp"],"latest_commit_sha":null,"homepage":null,"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/vzhong.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2017-04-19T21:18:42.000Z","updated_at":"2022-03-22T06:53:49.000Z","dependencies_parsed_at":"2022-08-30T17:11:45.360Z","dependency_job_id":null,"html_url":"https://github.com/vzhong/vocab","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/vzhong%2Fvocab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzhong%2Fvocab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzhong%2Fvocab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vzhong%2Fvocab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vzhong","download_url":"https://codeload.github.com/vzhong/vocab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248589789,"owners_count":21129680,"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":["machine-learning","nlp"],"created_at":"2024-10-14T09:44:14.969Z","updated_at":"2025-04-12T15:32:20.337Z","avatar_url":"https://github.com/vzhong.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Vocab\n=====\n\n.. image:: https://readthedocs.org/projects/vocab/badge/?version=latest\n    :target: http://vocab.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. image:: https://travis-ci.org/vzhong/vocab.svg?branch=master\n    :target: https://travis-ci.org/vzhong/vocab\n\nVocab is a python package that provides vocabulary objects for natural language processing.\n\n\nInstallation\n------------\n\n\n.. code-block:: sh\n\n    pip install vocab\n    pip install git+https://github.com/vzhong/vocab.git\n\n\nUsage\n-----\n\n.. code-block:: python\n\n    \u003e\u003e\u003e from vocab import Vocab, UnkVocab\n    \u003e\u003e\u003e v = Vocab()\n    \u003e\u003e\u003e v.word2index('hello', train=True)\n    0\n    \u003e\u003e\u003e v.word2index(['hello', 'world'], train=True)\n    [0, 1]\n    \u003e\u003e\u003e v.index2word([1, 0])\n    ['world', 'hello']\n    \u003e\u003e\u003e v.index2word(1)\n    'world'\n    \u003e\u003e\u003e small = v.prune_by_count(2)\n    \u003e\u003e\u003e small.to_dict()\n    {'counts': {'hello': 2}, 'index2word': ['hello']}\n    \u003e\u003e\u003e u = UnkVocab()\n    \u003e\u003e\u003e u.word2index(['hello', 'world'], train=True)\n    [1, 2]\n    \u003e\u003e\u003e u.word2index('hello friend !'.split())\n    [1, 0, 0]\n    \u003e\u003e\u003e u.index2word(0)\n    '\u003cunk\u003e'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzhong%2Fvocab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvzhong%2Fvocab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvzhong%2Fvocab/lists"}