Skip to content
Data and code for ACL 2019 paper: Global Textual Relation Embedding for Relational Understanding
Branch: master
Clone or download
Latest commit daec389 Jun 3, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
code update May 23, 2019
data Update Jun 3, 2019


Data and code for ACL 2019 paper "Global Textual Relation Embedding for Relational Understanding"


We will release the full relation graph soon!
The filtered relation graph and pre-trained models can be downloaded via Dropbox.

  |-small_graph --- The filtered relation graph used to train the textual relation embedding in this work.  
  |-train_data --- The filtered relation graph with the input format of the embedding model, for reference purpose.  
  |-models --- The pre-trained textual relation embedding models.  

For the filtered relation graph, we have the following format. The 3 columns are tab-separated:

textual_relation  KB_relation global_co-occurrence_statistics



python 2.7
tensorflow 1.6.0


  | ---  Hyperparamter settings and input/output file names.  
  | --- Train textual relation embedding model.  
  | --- Generate textual relation embedding with pre-trained model.  
  | --- The Transformer embedding model.  
  | --- The RNN embedding model.  
  | --- Utility functions.  
  |-kb_relation2id.txt --- Target KB relations.  
  |-vocab.txt --- Vocabulary file.  
  |-test.txt --- A sample textual relation input file.  
  to store the pre-trained models.  
  to store the result embeddings.  

Create two directories named model and result, to store pre-trained models and the result textual relation embeddings, respectively.

$ mkdir model  
$ mkdir result

Put the pre-trained embedding model under model/ directory. Change the model_dir variable in to the name of the pre-trained model you want to use.
Prepare the input textual relations (parsed with universial dependency) in a single file, with one textual relation per line. The tokens (including both lexical words and dependency relations) are seperated by "##". Refer to a sample input file data/test.txt.

Put the the input textual relations file under data/ directory as test.txt. Specify your output file name as the output_file variable in Then run to produce embeddings of the input textual relations:

$ python  

The output file of the textual relation embeddings have the similar format as word2vec.

You can’t perform that action at this time.