Giter Club home page Giter Club logo

etypeclus's Introduction

ETypeClus

This repository contains the code and data for EMNLP 2021 paper "Corpus-based Open-Domain Event Type Induction".

Datasets and Resources

Please download the datasets and related resources at: https://drive.google.com/drive/folders/1_QVv9XwN6PjZGdeMJWqW5D75NJmaD6F1?usp=sharing

  • Each dataset has its own subfolder, e.g., ./covid19/ and ./pandemic/.
  • The verb sense dictionary and background corpus statistics are placed under ./resources/ subfolder.

Please put the downloaded folders under the root directory.

Running ETypeClus

Parse Corpus and Extract Subject-Verb-Object Triplets

python3 parse_corpus_and_extract_svo.py \
    --is_sentence 1 \
    --input_file ./covid19/corpus.txt \
    --save_path ./covid19/corpus_parsed_svo.pk

Select Salient Verb Lemmas and Object Heads

python3 select_salient_terms.py \
    --corpus_w_svo_pickle ./covid19/corpus_parsed_svo.pk \
    --min_verb_freq 3 \
    --min_obj_freq 3

Generate Features for Each Salient <Predicate Lemma, Object Head> Mention

python3 generate_po_mention_features.py \
    --corpus_w_svo_pickle ./covid19/corpus_parsed_svo.pk \
    --top_k 50 \
    --gpu_id 5

Disambiguate Predicate Senses

python3 disambiguate_verb_sense.py \
    --mention_file ./covid19/corpus_parsed_svo_salient_po_mention_features.pk \
    --save_path ./covid19/po_mention_disambiguated.pk

Generate Features for Each Salient <Predicate Sense, Object Head> Tuples

python3 generate_po_tuple_features.py \
    --mention_file ./covid19/corpus_parsed_svo_salient_po_mention_features.pk \
    --sense_mapping ./covid19/po_mention_disambiguated.pk \
    --save_file ./covid19/po_tuple_features_all_svos.pk \
    --use_all_svos

Latent Space Clustering

CUDA_VISIBLE_DEVICES=0 python3 latent_space_clustering.py \
	--dataset_path ./pandemic \
	--input_emb_name po_tuple_features_all_svos.pk

Running Baselines

First follow previous section to generate the features for each salient <Predicate Sense, Object Head> tuples.

Then, Use the following command (with the corresponding baseline code file) to run Kmeans, sp-Kmeans, AggClus, and JCSC. Note that the spherecluster package requires an older version of scikit-learn, and we recommend using version 0.20.0.

python ./baselines/baseline-{agglo/kmeans/spkmeans/jcsc}.py \
    --input ./covid19/po_tuple_features_all_svos.pk \
    --output kmeans_result.json \
    --k 30

For Triframes, first follow the instructions in this link to install and set up the environment, and put it under the root directory. Then, run the following command

python ./baselines/baseline-triframes.py \
    --input ./covid19/po_tuple_features_all_svos.pk \
    --output triframes_result.json \
    --N 100 \
    --min_size 100

Reference

If you find this repository is useful, please consider citing our paper with the below bibliography. Thanks.

@inproceedings{Shen2021ETypeClus,
  title={Corpus-based Open-Domain Event Type Induction},
  author={Jiaming Shen and Yunyi Zhang and Heng Ji and Jiawei Han},
  booktitle={EMNLP},
  year={2021}
}

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.