Code Monkey home page Code Monkey logo

kesa's Introduction

This is the original source cod of KESA: A Knowledge Enhanced Approach For Sentiment Analysis. AACL, 2022.

Requirements

install Python 3.6

If you are using Windows, create python virtual environment by platform, e.g., Pycharm, and click install requirements.txt.

If your are using Ubuntu, create python virtual environment by python3 -m venv kesa, and next activate the virtual environment by source kesa/bin/activate, and then install python packages by pip install -r requirements.

Dataset and Rosources

For dataset MR, SST2, SST5 and IMDB, and sentiment lexicon SentiWordNet 3.0, your can download directly from here. For checkpoints, you can download from here.

Preprocess

Preprocess SentimentWordNet 3.0 to get word-level polarity by preprocess_lexicon/gen_word_level_polarity.py.

Fine-tune

You can fine-tune KESA on SST2 dataset based on checkpoints released by SentiLARE, with label combination is CC (conditional combination) using this command: python run_sentiment_classifier.py --do_train --do_eval --model_type roberta_2task --model_name_or_path ../models/SentiLARE_pretrain_roberta --task_name sst-2 --data_dir ../dataset/SST_2/ --all_data_file ../dataset/SST_2/sst.binary.all --lexicon_file ../dataset/lexicon/SWN.word.polarity --num_train_epochs 3.0 --per_gpu_eval_batch_size 1000 --per_gpu_train_batch_size 32 --max_seq_length 128 --learning_rate 2e-5 --loss_type aggregation --loss_balance_type add_vec --c 0.01 --seed 11

For more commands, please refer to commands.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.