Git Product home page Git Product logo

multi-hop-knowledge-paths-human-needs's Introduction

Ranking and Selecting Multi-Hop Knowledge Paths to Better Predict Human Needs (NAACL 2019)

This directory contains the following parts of the 'Ranking and Selecting Multi-Hop Knowledge Paths to Better Predict Human Needs' experiment. We present a novel method to extract, rank, filter and select multi-hop relation paths from a commonsense knowledge resource to interpret the expression of sentiment in terms of their underlying human needs. Multi-Hop Knowledge Model

Requirements

- python3+
- nltk
- igraph
- Tensorflow 1.12.0
- Tensorflow-hub

Install

- pip install tensorflow
- pip install tensorflow-hub
- pip install nltk
- pip install python-igraph
- pip install spacy 
- pip install sklearn

About Data

Modeling Naive Psychology of Characters in Simple Commonsense Stories

ConceptNet:

ConceptNet 5.6.0 

Data prep :

Please find more details in this folder

Run

Steps:

Download the csv file from ConceptNet webpage

File Link: path_to_ConceptNet_csv_file

Construct ConceptNet into a graph:

python src/graph_model/conceptnet2graph.py path_to_ConceptNet_csv_file 

In this step we make the conceptnet.csv into a graph representation as conceptnet .

To construct subgraph per sentence:

python src/graph_model/make_sub_graph_server.py "inputfile" "graphpath" "outputpath" "--purpose" purpose

Here, the graphpath is the above constructed graph which is 'concept_graph_full'

Requirements:

Input Sample

Inputfile: Path to the input file as mentioned in this Input Sample 
Graphpath: Path of the conceptnet as graph. 
Output path: Path to store the subgraph
Purpose: dev or train or test

Please note: You need to extract the concepts for each sentence using n-gram matching.

To extract relevant knowledge paths:

python src/graph_model/extract_path.py --graph_path --input_path --output_path --input_path
               or 
./src/graph_model/run_extraction.sh

Requirements:

Graphpath: Path of the subgraph. 
Inputfile: Path to the input file as mentioned in this Input sample
Output path: Path to store knowledge paths per context_sentence_ids. 
Purpose: dev or train or test

Data Format and Requirements:

Please find the data format in data_prep

Finally, to run the neural model:

./src/neural_model/run_experiment.sh

Reference

If you make use of the contents of this repository, please cite the following paper:

@inproceedings{paul-frank-2019-ranking,
    title = "Ranking and Selecting Multi-Hop Knowledge Paths to Better Predict Human Needs",
    author = "Paul, Debjit  and
      Frank, Anette",
    booktitle = "Proceedings of the 2019 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)",
    month = jun,
    year = "2019",
    address = "Minneapolis, Minnesota",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/N19-1368",
    pages = "3671--3681",
    abstract = "To make machines better understand sentiments, research needs to move from polarity identification to understanding the reasons that underlie the expression of sentiment. Categorizing the goals or needs of humans is one way to explain the expression of sentiment in text. Humans are good at understanding situations described in natural language and can easily connect them to the character{'}s psychological needs using commonsense knowledge. We present a novel method to extract, rank, filter and select multi-hop relation paths from a commonsense knowledge resource to interpret the expression of sentiment in terms of their underlying human needs. We efficiently integrate the acquired knowledge paths in a neural model that interfaces context representations with knowledge using a gated attention mechanism. We assess the model{'}s performance on a recently published dataset for categorizing human needs. Selectively integrating knowledge paths boosts performance and establishes a new state-of-the-art. Our model offers interpretability through the learned attention map over commonsense knowledge paths. Human evaluation highlights the relevance of the encoded knowledge.",
}

multi-hop-knowledge-paths-human-needs's People

Contributors

debjitpaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

multi-hop-knowledge-paths-human-needs's Issues

About data

Hello, I want to know where can I find the "path_to_ConceptNet_csv_file" and "inputfile"? Thank you!

About data

Hello,
how can I get the "inputfile" as mentioned in the Input Sample? And is "graphpath" the "concept_graph_full" from previous step?
How can I get "train_data.txt", "dev_data.txt" and "test_data.txt"?
Thank you!

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.