Knowledge Graph Emedding with relation-definition and relation-entity attention.
- Check in
./data/
, whether specific dataset exist.
data--FB15k
--FB15k237---train.txt
---valid.txt
---text.txt
---entity2multisentdesc.txt
---entity2type.txt
---entity_symbol2type.txt
```
train.txt : head_symbol \t relation \t tail+symbol in each one col.
valid.txt : head_symbol \t relation \t tail+symbol in each one col.
test.txt : head_symbol \t relation \t tail+symbol in each one col.
entity_symbol2cano.txt : entity_symbol \t entity canonical name in each one col.
entity_symbol2type.txt : entity_symbol \t type1 \t type2 \t type3 ... in each one col.
entity_symbol2multisentdesc.txt : entity_symbol \t multisentence description in each one col.
```
Preprocess run command example:
python3 preprocess_ent2type_desc_cano_reladj.py -entity_symbol2cano_type_desc_alreadydumped False -reverse_rel_data_alreadydumped False -KBdataset FB15k-237 -spacy_model_str en_core_web_lg -multiprocess True
-
First, download WordNet-3.0.tar.gz to
./misc_data/
and dotar -xzvf *
-
run
python3 preprocess_wordnet.py -KBdataset WN18
(andpython3 preprocess_wordnet.py -KBdataset WN18RR
)- If train/dev/test/ exists in
./data/WN**/
, you can use this preprocessor to another WN** datasets.
- If train/dev/test/ exists in
-
run
python3 preprocess_ent2type_desc_cano_reladj.py -entity_symbol2cano_type_desc_alreadydumped False -reverse_rel_data_alreadydumped False -KBdataset WN18 -spacy_model_str en_core_web_lg -multiprocess True
- First Download
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/nif_context_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/infobox_properties_en.ttl.bz2
wget http://downloads.dbpedia.org/2016-10/core-i18n/en/labels_en.ttl.bz2
to ./misc_data/dbpedia2016/
then
cd misc_data/dbpedia2016/
python dbpedia_ents_prep.py infobox_properties_en.ttl.bz2 labels_en.ttl.bz2 nif_context_en.ttl.bz2 > dbpedia_ents.text.jsonl
Next, run context preprocessor.
python3 preprocess_dbpedia.py -jsonl2json_alreadydumped False -entitycheckalreadydone False -parsed_json_squeezing_by_entities_on_db50_and_db500_already False
nohup sh preprocess_dbpedia.sh > 191123_preprocess_dbpedia.log &
This will take 6-10 hours on 72 core cpus.