Git Product home page Git Product logo

transte's Introduction

Transition-based end-to-end Triplet Extraction

Source code for Neurocomputing paper: Neural Transition Model for Aspect-based Sentiment Triplet Extraction with Triplet Memory

Transition scheme

Triplet Memory

Dependencies:

  • DyNET 2.1
  • Pyyaml 5.1
  • gensim 3.7.3
  • Pytorch 1.1.0
  • pytorch-transformer 1.2.0
  • flair 0.4.3
  • AllenNLP

Dataset:

See example data data/triplet/14lap/train.json.

Drivers updated ok but the BIOS update froze the system up and the computer shut down .####Drivers=T-POS updated=O ok=O but=O the=O BIOS=TT-NEG update=TT-NEG froze=O the=O system=TTT-NEG up=O and=O the=O computer=O shut=O down=O .=O####Drivers=O updated=O ok=S but=O the=O BIOS=O update=O froze=SS the=O system=O up=O and=O the=O computer=O shut=O down=O .=O####[([0], [2], 'POS'), ([5, 6], [7], 'NEG'), ([9], [7], 'NEG')]

Each line includes four parts which seperate by '####':

  • raw input sentence.
  • Aspect terms with sentiment polarity which are labeled with 'O/T/TT/TTT'.
  • Opinion term which are labeled with 'O/S/SS/SSS'.
  • Triplets which is formed as '[(aspect term, opinion term, polarity)]'

Configurations

  • data_config.yaml (for locating file paths)
  • joint_config.yaml (for parameters tuning)

Preprocess for preparing ready-to-go data:

  • Put glove.6B.100d.txt in embedding_dir which is set in the data_config.yaml

  • Then make vocabulary and pickle instances by (Note: we employ Corenlp to obtain the dependency tree and POS tags):

python preprocess.py
  • (Optional) Generate BERT Embeddings (bert-base-uncased):
python gen_bert_emb.py

Note that if you don`t use BERT, set use_sentence_vec to false in joint_config.yaml.

Train & Evaluate:

python train.py

transte's People

Contributors

chocowu avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.