Git Product home page Git Product logo

rdf-to-text's Introduction

README

This is the code for: RDF-to-Text Generation with Graph-augmented Structural Neural Encoders (IJCAI 2020)

WebNLG Dataset1 preprocess

  • The train/dev/test data processed with entity masking can be found under directory "data/preprocess_input"
    • train/dev/test-webnlg-all-delex.triple
    • train/dev/test-webnlg-all-delex.lex
    • If you want to restore the "ent_id: ent_name" information, please use the data train/dev/test_gtrlstm.pkl
  • Run "build_dataset.py" to use the processed data above to build input dataset
    • seq_train/test/dev.pt
    • gcn_train/test/dev.pt
    • gtr2_train/test/dev.pt
    • gcn_gtr2_train/test/dev.pt

Train model

  • The configuration files for each model is in "utils/".
  • If you want to train the bi-GCN model on WebNLG dataset1, copy the "config_webnlg1_gcn.py" to "config.py" and run "main_PG.py".

Translate

  • Set the mode = 'translate' and load_model = True in config files and run "main_PG.py" to generate texts.
  • The generated text can be found in "data/translate_result"

Unmask the eid in generated text

  • run "data/translate_result/ent_unmask.py", the file “gcn_translate_43.txt” will be transformed to “gcn_translate_43_relex.txt”.

Evaluate the generated text

  • run "webnlg_eval_scripts/webnlg_gcnonmt_relexicalise.py" using the arguments as follows:
-i
../data/
-f
../data/translate_result/gcn_translate_43_relex.txt
-p
test
-c
seen
-l
  • generate a final file: “gcn_translate_43_relex_relexicalised_predictions.txt”

  • run "calculate_bleu_dev.sh" to calculate BLEU scores

rdf-to-text's People

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.