Giter Site home page Giter Site logo

datgru's Introduction

EMNLP 2019 short paper

Recognizing Conflict Opinions in Aspect-level Sentiment Classification with Dual Attention Networks

Code is edited based on https://github.com/wxue004cs/GCAE

Environment: Python 3.6 Pytorch 0.4.0 torchtext 0.3.1 numpy 1.16.2 sacremoses 0.0.7 nltk 3.3.0

Pretrained Word Embedding: download the file glove.840B.300d.txt and put it under /embedding folder http://nlp.stanford.edu/data/glove.840B.300d.zip

Get word_list:

#encoding: utf-8
import os
def get_glove_words(glove_file_path):
    if not os.path.exists(glove_file_path):
        print(glove_file_path + ' not exists!')
        return []
    words_list = []
    with open(glove_file_path, 'r', encoding="utf-8") as fo:
        for line in fo:
            word = line.encode().decode('utf-8').strip().split(' ')[0]
            #print(word)
            words_list.append(word)
    return words_list

Produce "glove_words.txt" file in /embedding folder:

words_list = get_glove_words('glove.840B.300d.txt')
print(len(words_list))
with open('glove_words.txt', 'w', encoding="utf-8") as fo:
    for w in words_list:
        fo.write(w+'\n')

Run: Enter /model_files/ run train_gcae.sh run train_ataelstm.sh run train_datgru.sh

If our code helps, please cite:

@inproceedings{tan-etal-2019-recognizing,
    title = "Recognizing Conflict Opinions in Aspect-level Sentiment Classification with Dual Attention Networks",
    author = "Tan, Xingwei  and
      Cai, Yi  and
      Zhu, Changxi",
    booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)",
    month = nov,
    year = "2019",
    address = "Hong Kong, China",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/D19-1342",
    doi = "10.18653/v1/D19-1342",
    pages = "3417--3422",
}

datgru's People

Contributors

tanxw17 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.