{"id":16108688,"url":"https://github.com/aliosm/semantic-question-similarity","last_synced_at":"2026-03-11T15:37:24.600Z","repository":{"id":90007434,"uuid":"186050807","full_name":"AliOsm/semantic-question-similarity","owner":"AliOsm","description":"Official implementation of: Tha3aroon at NSURL-2019 Task 8: Semantic Question Similarity in Arabic","archived":false,"fork":false,"pushed_at":"2024-08-02T16:21:08.000Z","size":440708,"stargazers_count":13,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-09T04:53:08.682Z","etag":null,"topics":["attention","bert","elmo","neural-networks","onlstm","ordered-neurons-lstm","semantic-textual-similarity"],"latest_commit_sha":null,"homepage":"","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/AliOsm.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-05-10T20:32:09.000Z","updated_at":"2023-01-02T11:42:54.000Z","dependencies_parsed_at":"2024-10-27T17:42:36.532Z","dependency_job_id":null,"html_url":"https://github.com/AliOsm/semantic-question-similarity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AliOsm/semantic-question-similarity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fsemantic-question-similarity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fsemantic-question-similarity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fsemantic-question-similarity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fsemantic-question-similarity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AliOsm","download_url":"https://codeload.github.com/AliOsm/semantic-question-similarity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AliOsm%2Fsemantic-question-similarity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30386181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["attention","bert","elmo","neural-networks","onlstm","ordered-neurons-lstm","semantic-textual-similarity"],"created_at":"2024-10-09T19:27:53.724Z","updated_at":"2026-03-11T15:37:24.584Z","avatar_url":"https://github.com/AliOsm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/tha3aroon-at-nsurl-2019-task-8-semantic/question-similarity-on-q2q-arabic-benchmark)](https://paperswithcode.com/sota/question-similarity-on-q2q-arabic-benchmark?p=tha3aroon-at-nsurl-2019-task-8-semantic)\n\n# Semantic-Question-Similarity\n\nThe official implementation of our paper: [Tha3aroon at NSURL-2019 Task 8: Semantic Question Similarity in Arabic](https://arxiv.org/abs/1912.12514), which was part of [NSURL-2019](http://nsurl.org/tasks/task8-semantic-question-similarity-in-arabic/) workshop on [Task 8](https://www.kaggle.com/c/nsurl-2019-task8) for Arabic Semantic Question Similarity.\n\n\n## 0. Prerequisites\n- Python \u003e= 3.6\n- Install required packages listed in `requirements.txt` file\n    - `pip install -r requirements.txt`\n- To use ELMo embeddings:\n  - Clone ELMoForManyLangs repository\n    - `git clone https://github.com/HIT-SCIR/ELMoForManyLangs.git`\n  - Install the package:\n    - `cd ELMoForManyLangs`\n    - `python setup.py install`\n    - `cd ..`\n  - Download and unzip Arabic pre-trainled ELMo model\n    - `wget http://vectors.nlpl.eu/repository/11/136.zip -O elmo_dir/136.zip`\n    - `unzip elmo_dir/136.zip -d elmo_dir`\n    - `cp ELMoForManyLangs/configs/cnn_50_100_512_4096_sample.json elmo_dir/cnn_50_100_512_4096_sample.json`\n\n## 1. Data Preprocessing\nData preprocessing step to separate punctuations from words\n```\npython 1_preprocess.py --dataset-split train\npython 1_preprocess.py --dataset-split test\n```\n\n## 2. Data Enlarging\nEnlarging the data using both Positive and Negative Transitive properties (descriped in the [paper](paper-url))\n```\npython 2_enlarge.py\n```\n\n## 3. Generating Words Embeddings\nTo make the training step faster, we pre-generate words embeddings from either *ELMo* or *BERT* models and store them in a pickle file\n```\npython 3_build_embeddings_dict.py --embeddings-type elmo # For ELMo\npython 3_build_embeddings_dict.py --embeddings-type bert # For BERT\n```\n**We adopted using [ELMoForManyLangs](https://github.com/HIT-SCIR/ELMoForManyLangs) over [bert-embedding](https://github.com/imgarylai/bert-embedding) because it yields better results.**\n\n## 4. Model Training\nTraining the model using ELMo with 0.2 dropout, 256 batch size, 100 epochs and 2000 dev set size\n```\npython 4_train.py --embeddings-type elmo --dropout-rate 0.2 --batch-size 256 --epochs 100 --dev-split 2000\n```\n**This hyperparameters setup gives the best results according to our experiments, change the values in order to experiment more..**\n\n## 5. Model Inferencing\nInferencing predictions for the test set is done given the path to a certain checkpoint, the default threshold is `0.5` which can be changed using the optional argument `--threshold`\n```\npython 5_infer.py --model-path checkpoints/epoch100.h5\n```\n\n## Model Structure\n\nThe following figure illustrates our best model structure.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"plots/model_representation.png\"\u003e\n\u003c/p\u003e\n\n#### Note: All codes in this repository are tested on [Ubuntu 18.04](http://releases.ubuntu.com/18.04)\n\n## Contributors\n1. [Ali Hamdi Ali Fadel](https://github.com/AliOsm).\u003cbr/\u003e\n2. [Ibraheem Tuffaha](https://github.com/IbraheemTuffaha).\u003cbr/\u003e\n3. [Mahmoud Al-Ayyoub](https://github.com/malayyoub).\u003cbr/\u003e\n\n## License\nThe project is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliosm%2Fsemantic-question-similarity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliosm%2Fsemantic-question-similarity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliosm%2Fsemantic-question-similarity/lists"}