{"id":22054069,"url":"https://github.com/soujanyaporia/aspect-extraction","last_synced_at":"2025-05-12T02:51:04.171Z","repository":{"id":46591991,"uuid":"142656771","full_name":"soujanyaporia/aspect-extraction","owner":"soujanyaporia","description":"Aspect extraction from product reviews - window-CNN+maxpool+CRF, BiLSTM+CRF, MLP+CRF","archived":false,"fork":false,"pushed_at":"2021-05-16T01:12:00.000Z","size":327,"stargazers_count":158,"open_issues_count":1,"forks_count":38,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T22:01:35.768Z","etag":null,"topics":["aspect-based-sentiment-analysis","aspect-extraction","bilstm-crf","cnn","cnn-crf","semeval2014","semeval2016","sentiment-analysis","sequence-labeling","tensorflow"],"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/soujanyaporia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-28T07:29:26.000Z","updated_at":"2025-03-01T00:06:14.000Z","dependencies_parsed_at":"2022-07-20T05:00:18.772Z","dependency_job_id":null,"html_url":"https://github.com/soujanyaporia/aspect-extraction","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/soujanyaporia%2Faspect-extraction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soujanyaporia%2Faspect-extraction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soujanyaporia%2Faspect-extraction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soujanyaporia%2Faspect-extraction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soujanyaporia","download_url":"https://codeload.github.com/soujanyaporia/aspect-extraction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253666020,"owners_count":21944619,"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":["aspect-based-sentiment-analysis","aspect-extraction","bilstm-crf","cnn","cnn-crf","semeval2014","semeval2016","sentiment-analysis","sequence-labeling","tensorflow"],"created_at":"2024-11-30T15:19:28.000Z","updated_at":"2025-05-12T02:51:04.141Z","avatar_url":"https://github.com/soujanyaporia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aspect extraction from product reviews with Tensorflow\n\nThis repo has multiple sequential models for aspect extraction from product reviews.\n\n## Citation\n\nIf the code is useful in your research, please cite the following paper:\n\nPoria, S., Cambria, E. and Gelbukh, A., 2016. Aspect extraction for opinion mining with a deep convolutional neural network. Knowledge-Based Systems, 108, pp.42-49.\n\n## Task\n\nGiven a sentence, the task is to extract aspects. Here is an example\n\n```\nI like the battery life of this phone\"\n\nConverting this sentence to IOB would look like this -\n\nI O\nlike O\nthe O\nbattery B-A\nlife I-A\nof O\nthis O\nphone O\n\n```\n\n\n## Model\n\nSimilar to [Ma and Hovy](https://arxiv.org/pdf/1603.01354.pdf).\n\n- concatenate final states of a bi-lstm on character embeddings to get a character-based representation of each word\n- concatenate this representation to a standard word vector representation (GloVe here)\n- run a bi-lstm on each sentence to extract contextual representation of each word\n- decode with a linear chain CRF\n\nSimilar to [Collobert et al.] (http://ronan.collobert.com/pub/matos/2011_nlp_jmlr.pdf)\n\n- form a window around the word to tag\n- apply MLP on that window\n- obtain logits\n- apply viterbi (CRF) for sequence tagging\n\nSimilar to [Poria et al.](https://www.sciencedirect.com/science/article/pii/S0950705116301721)\n\n- form a window around the word to tag\n- apply CNN on that window\n- apply maxpool on that window (Caution: different from global maxpool)\n- obtain logits\n- apply CRF for sequence tagging\n\n## XML to IOB\n\n```\npython xmlToIOB.py\n```\n\n## Details\n\nDownload Glove embeddings (GloVe: http://nlp.stanford.edu/data/glove.840B.300d.zip )\n\n1. [DO NOT MISS THIS STEP] Build vocab from the data and extract trimmed glove vectors according to the config in `model/config.py`.\n\n```\npython build_data.py\n```\n\n2. Train the model with\n\n```\npython train.py\n```\n\n\n3. Evaluate and interact with the model with\n```\npython evaluate.py\n```\n\n\nData iterators and utils are in `model/data_utils.py` and the model with training/test procedures is in `model/aspect_model.py`\n\n\n## Training Data\n\n\nThe training data must be in the following format (identical to the CoNLL2003 dataset).\n\nA default test file is provided to help you getting started.\n\n\n```\nThe\tO\nduck\tB-A\nconfit\tI-A\nis\tO\nalways\tO\namazing\tO\nand\tO\nthe\tO\nfoie\tB-A\ngras\tI-A\nterrine\tI-A\nwith\tI-A\nfigs\tI-A\nwas\tO\nout\tO\nof\tO\nthis\tO\nworld\tO\n\nThe\tO\nwine\tB-A\nlist\tI-A\nis\tO\ninteresting\tO\nand\tO\nhas\tO\nmany\tO\ngood\tO\nvalues\tO\n```\n\n\nOnce you have produced your data files, change the parameters in `config.py` like\n\n```\n# dataset\nfilename_train = \"data/ABSA16_Restaurants_Train_SB1_v2_mod.iob\"\nfilename_dev = \"data/EN_REST_SB1_TEST_2016_mod.iob\"\nfilename_test = \"data/EN_REST_SB1_TEST_2016_mod.iob\"\n```\n\n## Result\n\nChunk based evaluation\n\n```\nLaptop 2014 -\u003e F1 - 79.93\n\nRestaurant 2014 -\u003e F1 - 84.22\n```\nPartial matching based evaluation\n```\nLaptop 2014 -\u003e F1 - 86.84\nRestaurant 2014 -\u003e F1 - 88.42\n```\n\n## License\n\nThis project is licensed under the terms of the apache 2.0 license (as Tensorflow and derivatives). If used for research, citation would be appreciated.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoujanyaporia%2Faspect-extraction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoujanyaporia%2Faspect-extraction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoujanyaporia%2Faspect-extraction/lists"}