{"id":20419818,"url":"https://github.com/nhatsmrt/wiki-dpr","last_synced_at":"2025-04-12T17:43:14.753Z","repository":{"id":54757237,"uuid":"329444854","full_name":"nhatsmrt/wiki-dpr","owner":"nhatsmrt","description":"A simple tool to retrieve relevant Wikipedia passages","archived":false,"fork":false,"pushed_at":"2021-01-31T17:41:10.000Z","size":61,"stargazers_count":2,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T12:03:49.281Z","etag":null,"topics":["annoy","approximate-nearest-neighbor-search","cli","click","colab-notebook","command-line-tool","flask-application","information-retrieval","pytorch","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nhatsmrt.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}},"created_at":"2021-01-13T22:17:46.000Z","updated_at":"2023-05-22T08:12:12.000Z","dependencies_parsed_at":"2022-08-14T01:50:59.209Z","dependency_job_id":null,"html_url":"https://github.com/nhatsmrt/wiki-dpr","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/nhatsmrt%2Fwiki-dpr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatsmrt%2Fwiki-dpr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatsmrt%2Fwiki-dpr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhatsmrt%2Fwiki-dpr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nhatsmrt","download_url":"https://codeload.github.com/nhatsmrt/wiki-dpr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550630,"owners_count":21122932,"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":["annoy","approximate-nearest-neighbor-search","cli","click","colab-notebook","command-line-tool","flask-application","information-retrieval","pytorch","transformers"],"created_at":"2024-11-15T06:38:44.357Z","updated_at":"2025-04-12T17:43:14.719Z","avatar_url":"https://github.com/nhatsmrt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wikipedia Passage Retriever\n\nThis package allows for retrieving Wikipedia passages (i.e paragraphs) relevant to a question.\n\nUnder the hood, it uses a [dense passage retriever](https://arxiv.org/pdf/2004.04906.pdf), with pretrained model from HuggingFace's [transformers](https://github.com/huggingface/transformers) library.\n\n## Usage\n\nTo install the package (which comes with the command-line tool), run the following command in terminal:\n```\n  pip install wiki-passage-retriever\n```\n\nThe easiest way to play with the package is to use the command line tool. For instance:\n```\n# Indexing a wikipedia page:\nwikiretriever index -q \"Nelson Mandela\" -f nelsonindex\n\n# Retrieve relevant passages from index:\nwikiretriever indexed-retrieve -q \"Who was Nelson Mandela?\" -f nelsonindex -k 5\n\n# Slow retrieval:\nwikiretriever retrieve --query \"Nelson Mandela\" --question \"Who was Nelson Mandela's father?\" --topk 5\n```\n\nI also created a simple [flask application](flask-app/) to retrieve and display the results.\n\n[Colab Notebook Examples](https://colab.research.google.com/drive/1szwoqAAGgwKossSQenCFIvrWoX_CD_QU?usp=sharing)\n\n## TODO:\n  * ~~Add option to retrieve k best passages~~\n  * (Maybe) retrieve individual sentences instead of paragraphs?\n  * (When the bug is fixed) Switch to out-of-the-box Huggingface's tokenizer.\n  * Add option to run model on GPU\n  * Add option to search from different wikipedia articles (e.g first k results from search query)\n  * Add option to control text truncation (for now, always use full text).\n  * Extract span (instead of outputting entire text)\n  * Validate inputs and edge cases\n  * Protect database by transactions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhatsmrt%2Fwiki-dpr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhatsmrt%2Fwiki-dpr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhatsmrt%2Fwiki-dpr/lists"}