{"id":19467457,"url":"https://github.com/thunlp/ffd","last_synced_at":"2025-09-11T16:46:18.154Z","repository":{"id":76097127,"uuid":"176087369","full_name":"thunlp/FFD","owner":"thunlp","description":"Source code for NAACL 2019 paper \"Fact Discovery from Knowledge Base via Facet Decomposition\".","archived":false,"fork":false,"pushed_at":"2019-05-15T12:10:22.000Z","size":11345,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-25T11:41:32.758Z","etag":null,"topics":["knowledge-embedding"],"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/thunlp.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-03-17T10:45:08.000Z","updated_at":"2021-04-29T08:49:04.000Z","dependencies_parsed_at":"2023-03-05T09:15:25.979Z","dependency_job_id":null,"html_url":"https://github.com/thunlp/FFD","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thunlp/FFD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FFFD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FFFD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FFFD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FFFD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thunlp","download_url":"https://codeload.github.com/thunlp/FFD/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thunlp%2FFFD/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274672481,"owners_count":25328547,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["knowledge-embedding"],"created_at":"2024-11-10T18:35:15.564Z","updated_at":"2025-09-11T16:46:18.143Z","avatar_url":"https://github.com/thunlp.png","language":"Python","readme":"# Fact Discovery from Knowledge Base via Facet Decomposition\nThis repo contains the source code and dataset for the following paper:\nFact Discovery from Knowledge Base via Facet Decomposition. Zihao Fu, Yankai Lin, Zhiyuan Liu and Wai Lam. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT 2019). [PDF](https://arxiv.org/abs/1904.09540)\n\n## How to use our code for FFD\n\n### Prerequisite\n- g++ 7.3.0\n- Python 2.7.16\n\nAll the codes are tested under Ubuntu 18.04.1 LTS.\n\n### Dataset\nWe made a new dataset based on FB15k, it was already in `ANALOGY/FB15k`. The dataset structure is as follows:\n\n    FB15k\n    ├── p0.5-entities.txt\n    ├── p0.5-relations.txt \n    ├── p0.5-test.txt\n    ├── p0.5-train.txt\n    ├── p0.5-valid.txt\n    ├── entity2id.txt\n    └── relation2id.txt\n\nin which, `p0.5-train.txt`, `p0.5-test.txt`, `p0.5-valid.txt` are the tain, test and valid set respectively. Each line contains the head, relation and tail of a fact. `p0.5-entities.txt` and `p0.5-relations.txt` contains the name of all entities and relations. `entity2id.txt` and `relation2id.txt` contain ids for entities and relations.\n\n\n\n### Usage\n1. Clone\n```\ngit clone https://github.com/fuzihaofzh/FFD.git\n```\n\n2. Compile \u0026 Install\n```\ncd ANALOGY\nmake\ncd ..\npip install -r requirements.txt\n```\n\n3. Train Entity-relation Facet Component \u0026 Tail Inference Facet Component\n```\npython facts_discovery.py run --inputTag p0.5 --cudaId 0 --step trainCorNet\nANALOGY/main -algorithm Analogy -model_path output/Analogy_FB15k_p0.5.model -dataset ANALOGY/FB15k/p0.5 -num_thread 8\n```\nin `facts_discovery.py`, `inputTag` is the dataset prefix. `cudaId` is the gpu divice id.  `step` is the running mode.\nin `ANALOGY/main`, `model_path` is the place to save the model. `dataset` is the dataset path and `num_thread` is the thread number.\n\n4. Train FFD and predict\n```\npython facts_discovery.py run --inputTag p0.5 --cudaId 0 --step feedback\n```\n\n\n### Cite\n\n    @inproceedings{fu2019fact,\n      title={Fact Discovery from Knowledge Base via Facet Decomposition},\n      author={Fu, Zihao and Lin, Yankai and Liu, Zhiyuan and Lam, Wai},\n      booktitle={Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers)},\n      volume={1},\n      year={2019}\n    }\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Fffd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthunlp%2Fffd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunlp%2Fffd/lists"}