{"id":13674147,"url":"https://github.com/guotong1988/NL2SQL-RULE","last_synced_at":"2025-04-28T14:30:44.815Z","repository":{"id":45020505,"uuid":"215912284","full_name":"guotong1988/NL2SQL-RULE","owner":"guotong1988","description":"Content Enhanced BERT-based Text-to-SQL Generation https://arxiv.org/abs/1910.07179","archived":false,"fork":false,"pushed_at":"2024-10-17T01:27:21.000Z","size":6645,"stargazers_count":192,"open_issues_count":2,"forks_count":49,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-17T20:08:18.289Z","etag":null,"topics":["bert","deep-learning","knowledge","knowledge-representation","nl2sql","nlp","pytorch","rule-inject-to-model","semantic-parsing","text2sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guotong1988.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-18T00:54:02.000Z","updated_at":"2025-03-20T12:35:24.000Z","dependencies_parsed_at":"2024-11-11T14:34:35.944Z","dependency_job_id":"7c167e63-7b9a-4d57-ae4d-4089dbec066e","html_url":"https://github.com/guotong1988/NL2SQL-RULE","commit_stats":null,"previous_names":["guotong1988/nl2sql-bert"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guotong1988%2FNL2SQL-RULE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guotong1988%2FNL2SQL-RULE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guotong1988%2FNL2SQL-RULE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guotong1988%2FNL2SQL-RULE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guotong1988","download_url":"https://codeload.github.com/guotong1988/NL2SQL-RULE/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251330142,"owners_count":21572235,"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":["bert","deep-learning","knowledge","knowledge-representation","nl2sql","nlp","pytorch","rule-inject-to-model","semantic-parsing","text2sql"],"created_at":"2024-08-02T11:00:41.945Z","updated_at":"2025-04-28T14:30:43.092Z","avatar_url":"https://github.com/guotong1988.png","language":"Python","readme":"# NL2SQL-RULE\n\n[![LICENSE](https://img.shields.io/badge/license-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE)\n[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu)\n\nContent Enhanced BERT-based Text-to-SQL Generation https://arxiv.org/abs/1910.07179\n\n# Motivation\n\n### REASONABLE: Incorporating database design rule into text-to-sql generation: \n\n1. We use the matching information of the table cells and question string to construct a vector where\nits length is the same to the question length. This question vector mainly improves the performance\nof WHERE-VALUE inference result. Because it injects the knowledge that the answer cell and its\ncorresponding table header are bound together. **If we locate the answer cell then we locate the answer\ncolumn which contains the answer cell.**\n\n2. We use the matching information of all the table headers and the question string to construct a\nvector where its length is the same to the table headers’ length. This header vector mainly improves the\nperformance of WHERE-COLUMN inference result.\n\n# Requirements\n\npython 3.6\n\ntorch 1.1.0   \n\n# Run\n\n### Step-1\nData prepare: Download all origin data( https://drive.google.com/file/d/1iJvsf38f16el58H4NPINQ7uzal5-V4v4 or https://download.csdn.net/download/guotong1988/13008037) and put them at `data_and_model` directory.\n\nThen run `data_and_model/output_entity.py`\n\n### Step-2\n\nTrain and eval: `train.py`\n\n# Results on BERT-Base-Uncased without Execution-Guided-Decoding\n| **Model**   | Dev \u003cbr /\u003elogical form \u003cbr /\u003eaccuracy | Dev\u003cbr /\u003eexecution\u003cbr/\u003e accuracy | Test\u003cbr /\u003e logical form\u003cbr /\u003e accuracy | Test\u003cbr /\u003e execution\u003cbr /\u003e accuracy |\n| ----------- | ------------------------------------- | -------------------------------- | -------------------------------------- | ----------------------------------- |\n| SQLova    | 80.6                      | 86.5                  | 80.0                        | 85.5                   |\n| Our Method | 84.3                      | 90.3                | 83.7                      | 89.2 |\n\n# Data\nOne data view:\n```\n{\n\t\"table_id\": \"1-1000181-1\",\n\t\"phase\": 1,\n\t\"question\": \"Tell me what the notes are for South Australia \",\n\t\"question_tok\": [\"Tell\", \"me\", \"what\", \"the\", \"notes\", \"are\", \"for\", \"South\", \"Australia\"],\n\t\"sql\": {\n\t\t\"sel\": 5,\n\t\t\"conds\": [\n\t\t\t[3, 0, \"SOUTH AUSTRALIA\"]\n\t\t],\n\t\t\"agg\": 0\n\t},\n\t\"query\": {\n\t\t\"sel\": 5,\n\t\t\"conds\": [\n\t\t\t[3, 0, \"SOUTH AUSTRALIA\"]\n\t\t],\n\t\t\"agg\": 0\n\t},\n\t\"wvi_corenlp\": [\n\t\t[7, 8]\n\t],\n\t\"bertindex_knowledge\": [0, 0, 0, 0, 4, 0, 0, 1, 3],\n\t\"header_knowledge\": [2, 0, 0, 2, 0, 1]\n}\n```\nThe Corresponding Table:\n```\n{\n\t\"id\": \"1-1000181-1\",\n\t\"header\": [\"State/territory\", \"Text/background colour\", \"Format\", \"Current slogan\", \"Current series\", \"Notes\"],\n\t\"rows\": [\n\t\t[\"Australian Capital Territory\", \"blue/white\", \"Yaa·nna\", \"ACT · CELEBRATION OF A CENTURY 2013\", \"YIL·00A\", \"Slogan screenprinted on plate\"],\n\t\t[\"New South Wales\", \"black/yellow\", \"aa·nn·aa\", \"NEW SOUTH WALES\", \"BX·99·HI\", \"No slogan on current series\"],\n\t\t[\"New South Wales\", \"black/white\", \"aaa·nna\", \"NSW\", \"CPX·12A\", \"Optional white slimline series\"],\n\t\t[\"Northern Territory\", \"ochre/white\", \"Ca·nn·aa\", \"NT · OUTBACK AUSTRALIA\", \"CB·06·ZZ\", \"New series began in June 2011\"],\n\t\t[\"Queensland\", \"maroon/white\", \"nnn·aaa\", \"QUEENSLAND · SUNSHINE STATE\", \"999·TLG\", \"Slogan embossed on plate\"],\n\t\t[\"South Australia\", \"black/white\", \"Snnn·aaa\", \"SOUTH AUSTRALIA\", \"S000·AZD\", \"No slogan on current series\"],\n\t\t[\"Victoria\", \"blue/white\", \"aaa·nnn\", \"VICTORIA - THE PLACE TO BE\", \"ZZZ·562\", \"Current series will be exhausted this year\"]\n\t]\n}\n```\n\n# Trained model\n\nhttps://drive.google.com/open?id=18MBm9qzobTBgWPZlpA2EErCQtsMhlTN2\n\n# Reference \n\nhttps://github.com/naver/sqlova\n","funding_links":[],"categories":["GitHub","Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguotong1988%2FNL2SQL-RULE","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguotong1988%2FNL2SQL-RULE","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguotong1988%2FNL2SQL-RULE/lists"}