{"id":20580632,"url":"https://github.com/pmhalvor/racl","last_synced_at":"2026-06-05T17:31:13.672Z","repository":{"id":200455315,"uuid":"447541815","full_name":"pmhalvor/racl","owner":"pmhalvor","description":"Baseline for thesis on fine-grained sentiment analysis","archived":false,"fork":false,"pushed_at":"2022-03-19T15:10:23.000Z","size":17184,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T22:33:58.527Z","etag":null,"topics":["fgsa","fine-grained-sentiment-analysis","nlp","sentiment-analysis"],"latest_commit_sha":null,"homepage":"https://github.com/NLPWM-WHU/RACL","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmhalvor.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}},"created_at":"2022-01-13T09:38:38.000Z","updated_at":"2022-01-14T15:51:56.000Z","dependencies_parsed_at":"2023-10-17T01:39:51.025Z","dependency_job_id":null,"html_url":"https://github.com/pmhalvor/racl","commit_stats":null,"previous_names":["pmhalvor/racl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmhalvor%2Fracl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmhalvor%2Fracl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmhalvor%2Fracl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmhalvor%2Fracl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmhalvor","download_url":"https://codeload.github.com/pmhalvor/racl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242206045,"owners_count":20089255,"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":["fgsa","fine-grained-sentiment-analysis","nlp","sentiment-analysis"],"created_at":"2024-11-16T06:24:37.252Z","updated_at":"2026-06-05T17:31:13.626Z","avatar_url":"https://github.com/pmhalvor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RACL\n Code and datasets of our paper \"[Relation-Aware Collaborative Learning for Unified Aspect-Based Sentiment Analysis](https://www.aclweb.org/anthology/2020.acl-main.340/)\" accepted by ACL 2020.\n\n\n## 1. Requirements\n To reproduce the reported results accurately, please install the specific version of each package.\n\n* python 3.6.10\n* tensorflow-gpu 1.5.0\n* numpy 1.16.4\n* scikit-learn 0.22.2\n\n## 2. Usage\n We incorporate the training and evaluation of RACL in the **train_racl.py**. Just run it as below.\n\n```\nCUDA_VISIBLE_DEVICES=0 python train_racl.py --task res14 --load 0\n```\n\n We use the datasets pre-processed by [IMN](https://github.com/ruidan/IMN-E2E-ABSA). The results of 5 runs should be like this.\n\n | Res14  | AE\\-F1  | OE\\-F1  | SC\\-F1  | ABSA\\-F1 |\n |--------|---------|---------|---------|----------|\n | round1 | 85\\.38  | 85\\.31  | 74\\.72  | 70\\.80   |\n | round2 | 85\\.41  | 85\\.03  | 74\\.58  | 70\\.72   |\n | round3 | 85\\.20  | 85\\.55  | 74\\.26  | 70\\.43   |\n | round4 | 85\\.20  | 85\\.29  | 74\\.19  | 70\\.43   |\n | round5 | 85\\.68  | 85\\.42  | 74\\.56  | 70\\.96   |\n | **AVG**    | **85\\.37**  | **85\\.32**  | **74\\.46**  | **70\\.67**   |\n\n\n## 3. Checkpoints\n If you have problems in training RACL, you can also use the released pre-trained weights on the following links.\n\n* Google Drive : [Click here.](https://drive.google.com/file/d/1nfdqwEZfWsnQe6uOO7tx-QlmMFuomOW2/view?usp=sharing)\n* Baidu Cloud : [Click here.](https://pan.baidu.com/s/1OZODodg3O7DIG0hyjYQxJg) (password:78qy)\n\n Unzip the pre-trained weights in the **checkpoint** folder, and execute the command as below.  \n\n```\nCUDA_VISIBLE_DEVICES=0 python train_racl.py --task res14 --load 1\n```\n\n The results after loading weights should be like this.\n\n | Dataset | AE\\-F1  | OE\\-F1  | SC\\-F1  | ABSA\\-F1 |\n |---------|---------|---------|---------|----------|\n | Res14   | 85\\.33  | 86\\.09  | 76\\.31  | 71\\.61   |\n | Lap14   | 82\\.81  | 77\\.91  | 73\\.04  | 62\\.59   |\n | Res15   | 71\\.76  | 76\\.74  | 67\\.74  | 61\\.20   |\n\n## 4. Embeddings\n We have generated the word-idx mapping file and the global-purpose \u0026 domain-specific embeddings in the **data** folder. If you want to generate them from scratch, follow the steps below.\n\n* Download [glove.840B.300d.txt](https://nlp.stanford.edu/projects/glove/), rename it to **glove_emb.txt**, and put it in the folder like **./data/res14**.\n* Download [domain-specific vectors](https://howardhsu.github.io/) proposed by DE-CNN, rename it to **domain_emb.txt**, and put it in the folder like **./data/res14**. Notice that **restaurant_emb.vec** is for datasets Res14 and Res15, and **laptop_emb.vec** is for Lap14.\n* Specify the task (i.e., Res14) in **embedding.py**, then run it.\n* Word embeddings will be generated in the corresponding folder, e.g., **./data/res14/glove_embedding.npy**.\n\n## 5. Data Details\nA separate set consists of four files:\n\n* **sentence.txt** contains the tokenized review sentences.\r\n* **target.txt** contains the aspect term tag sequences. **0=O, 1=B, 2=I**.\r\n* **opnion.txt** contains the opinion term tag sequences. **0=O, 1=B, 2=I**.\r\n* **target_polarity.txt** contains the sentiment tag sequences. **0=background, 1=positive, 2=negative, 3=neutral, 4=conflict**.\n\n## 6. Need Better Results?\nIf you still need a better performance of RACL, you can increase the $hop_num$ argument in **train_racl.py**. Stacking layers to 5\\~6 can introduce 1\\~2% absolute improvements on ABSA-F1.\n\n## 7. RACL-BERT (2020.09.16 update)\nWe have updated the files for RACL-BERT. To run it, follow the steps below.\n\n* Upgrade the version of tensorflow-gpu to 1.12.0. (The lower version could deteriorate the performance.)\r\n* Download the [checkpoint](https://storage.googleapis.com/bert_models/2019_05_30/wwm_uncased_L-24_H-1024_A-16.zip) of BERT-Large, then unzip it in the folder **./bert-large/** (e.g., ./bert-large/bert_config.json).\r\n* Execute the command as below.\r\n\r\n\t```\n\tCUDA_VISIBLE_DEVICES=0 python train_racl_bert.py --task res14 --load 0\n\t```\n\n\n The results of RACL-BERT should be like this.\n\n | Dataset | AE\\-F1  | OE\\-F1  | SC\\-F1  | ABSA\\-F1 |\n |---------|---------|---------|---------|----------|\n | Res14   | 87\\.55  | 86\\.21  | 81\\.41  | 76\\.25   |\n | Lap14   | 82\\.24  | 79\\.19  | 75\\.05  | 65\\.67   |\n | Res15   | 74\\.20  | 74\\.58  | 75\\.65  | 66\\.07   |\n\n## 8. Citation\nIf you find our code and datasets useful, please cite our paper.\n\n  \n```\n@inproceedings{chen2020racl,\n  author    = {Zhuang Chen and Tieyun Qian},\n  title     = {Relation-Aware Collaborative Learning for Unified Aspect-Based Sentiment Analysis},\n  booktitle = {ACL},\n  pages     = {3685-3694},\n  year      = {2020},\n  url       = {https://www.aclweb.org/anthology/2020.acl-main.340}\n}\n```\n\n:checkered_flag: \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmhalvor%2Fracl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmhalvor%2Fracl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmhalvor%2Fracl/lists"}