—————————————————Train Triplets (first 5)————————————————————————————————————————————:
['10515194', '_derivationally_related_form', '02589576']
['10515194', '_derivationally_related_form', '02729023']
['10515194', '_derivationally_related_form', '03736970']
['10515194', '_derivationally_related_form', '05786372']
['10515194', '_derivationally_related_form', '10724699']
—————————————————train_paths (first 5)————————————————————————————————————————————:
[['path', ['10515194', '_derivationally_related_form', '00265386', '_derivationally_related_form', '00800940', '_hypernym', '00798245', '_derivationally_related_form', '02589576']]]
[['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09623038', '{_hypernym}^-1', '10162991', '{_derivationally_related_form}^-1', '02729023']], ['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09623038', '_derivationally_related_form', '01999423', '_verb_group', '02729023']]]
[]
[]
[['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09629752', '{_hypernym}^-1', '10335931', '{_hypernym}^-1', '10724699']]]
—————————————————train_rules (first 5)————————————————————————————————————————————:
[['rule', ['00798245', '{_derivationally_related_form}^-1', '02589576']]]
[['rule', ['08482271', '{_derivationally_related_form}^-1', '02729023']]]
[]
[['rule', ['01637166', '{_derivationally_related_form}^-1', '05786372']]]
[['rule', ['02232190', '{_derivationally_related_form}^-1', '10724699']]]
—————————————————train_merged (first 5)————————————————————————————————————————————:
[['path', ['10515194', '_derivationally_related_form', '00265386', '_derivationally_related_form', '00800940', '_hypernym', '00798245', '_derivationally_related_form', '02589576']], ['nopath'], ['nopath']]
[['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09623038', '{_hypernym}^-1', '10162991', '{_derivationally_related_form}^-1', '02729023']], ['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09623038', '_derivationally_related_form', '01999423', '_verb_group', '02729023']], ['nopath']]
[['nopath'], ['nopath'], ['nopath']]
[['rule', ['01637166', '{_derivationally_related_form}^-1', '05786372']], ['nopath'], ['nopath']]
[['path', ['10515194', '_hypernym', '09615465', '_hypernym', '00007846', '{_hypernym}^-1', '09629752', '{_hypernym}^-1', '10335931', '{_hypernym}^-1', '10724699']], ['nopath'], ['nopath']]
First 5 train_triplets:
['social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] think, an instance of deliberate thinking; "I need to give it a good think": == English == === Alternative forms === thinc [SEP]', 'social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] head up, be the first or leading member of (a group) and excel; "This student heads the class": == English == === Verb === head up (third-per [SEP]', 'social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] mechanical device, mechanism consisting of a device that works on mechanical principles: mechanical device [SEP]', 'social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] transferrer, someone who transfers something: == English == === Etymology === transfer +\u200e - [SEP]', 'social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] push, exert oneself continuously, vigorously, or obtrusively to gain an end or engage in a crusade for a certain cause or person; be an advocate for; "The liberal party pushed for reforms"; "She is crusading for women\'s rights"; "The Dean is pushing for his favorite candidate": == English == === Proper noun === Push (plura [SEP]']
['make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] derivationally related form [SEP] pass out, give to several people; "The teacher handed out the exams": == English == === Noun === pass-out (plural p [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] derivationally related form [SEP] gainsay, take exception to; "She challenged his claims": == English == === Etymology === From Middle E [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] derivationally related form [SEP] making, the act that results in something coming to be; "the devising of plans"; "the fashioning of pots and pans"; "the making of measurements"; "it was already in the making": == English == === Alternative forms === makei [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] derivationally related form [SEP] preparation, preparatory school work done outside school (especially at home): == English == === Alternative forms === præpa [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] derivationally related form [SEP] finding, the act of determining the properties of something, usually by research or calculation; "the determination of molecular structures": == English == === Etymology === From Middle E [SEP]']
['vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] entrant, someone who enters; "new entrants to the country must go though immigration procedures": == English == === Etymology === From French e [SEP]', 'vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] musculature, the muscular system of an organism: == English == === Etymology === Borrowed from [SEP]', 'vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] sense, perceive by a physical sensation, e.g., coming from the skin or muscles; "He felt the wind"; "She felt an object brushing her arm"; "He felt his flesh crawl"; "She felt the heat when she got out of the car": == German == === Etymology === From Old High [SEP]', 'vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] sac, a structure resembling a bag in an animal: == English == === Noun === SAC (plural SACs) [SEP]', 'vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP]']
['man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] restraint, the act of controlling by restraining someone or something; "the unlawful restraint of trade": == English == === Etymology === From Middle E [SEP]', 'man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] rising, a movement upward; "they cheered the rise of the hot-air balloon": == English == === Pronunciation === IPA(key): [SEP]', 'man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] vertical stabilizer, a stabilizer that is part of the vertical tail structure of an airplane: == English == === Alternative forms === verti [SEP]', 'man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] chromatin granule, the readily stainable substance of a cell nucleus consisting of DNA and RNA and various proteins; during mitotic division it condenses into chromosomes: == English == === Etymology === From Latin lī [SEP]', 'man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] arm, a human limb; technically the part of the superior limb between the shoulder and the elbow but commonly used to refer to the whole superior limb: == Translingual == === Symbol === arm (inter [SEP]']
['pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP] derivationally related form [SEP] taking hold, the act of gripping something firmly with the hands (or the tentacles): == English == === Verb === taking hold prese [SEP]', 'pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP] derivationally related form [SEP] pancreas, a large elongated exocrine gland located behind the stomach; secretes pancreatic juice and insulin: == English == === Etymology === Existing in E [SEP]', 'pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP] derivationally related form [SEP] barricado, block off with barricades: == English == === Noun === barricado (plural [SEP]', 'pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP] derivationally related form [SEP] rede, give advice to; "The teacher counsels troubled students"; "The lawyer counselled me when I was accused of tax fraud": == English == === Etymology === From Old Engl [SEP]', 'pleader, a lawyer who pleads cases in court: == English == === Etymology === Partly from M [SEP] derivationally related form [SEP] unionization, act of forming labor unions; "the issue underlying the strike was unionization": == English == === Alternative forms === union [SEP]']
First 5 train_merged:
[['think, imagine or visualize; "Just think--you could be rich one day!"; "Think what a scene it must have been!": == English == === Alternative forms === thinc [SEP] form related derivationally [SEP] think, an instance of deliberate thinking; "I need to give it a good think": == English == === Alternative forms === thinc [SEP]', '', ''], ['social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] hypernym [SEP] eristic, a person who disputes; who is good at or enjoys controversy [SEP] hypernym [SEP] soul, a human being; "there was too much for one person to do" [SEP] hypernym [SEP] leader, a person who rules or guides or inspires others [SEP] hypernym [SEP] top dog, a person who is in charge; "the head of the whole operation" [SEP] form related derivationally [SEP] head up, be the first or leading member of (a group) and excel; "This student heads the class": == English == === Verb === head up (third-per [SEP]', 'social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] hypernym [SEP] eristic, a person who disputes; who is good at or enjoys controversy [SEP] hypernym [SEP] soul, a human being; "there was too much for one person to do" [SEP] hypernym [SEP] leader, a person who rules or guides or inspires others [SEP] derivationally related form [SEP] lead, travel in front of; go in advance of others; "The procession was headed by John" [SEP] verb group [SEP] head up, be the first or leading member of (a group) and excel; "This student heads the class": == English == === Verb === head up (third-per [SEP]', ''], ['', '', ''], ['social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] hypernym [SEP] eristic, a person who disputes; who is good at or enjoys controversy [SEP] hypernym [SEP] soul, a human being; "there was too much for one person to do" [SEP] hypernym [SEP] traveller, a person who changes location [SEP] hypernym [SEP] mover, someone who moves [SEP] hypernym [SEP] transferrer, someone who transfers something: == English == === Etymology === transfer +\u200e - [SEP]', '', ''], ['social reformer, a disputant who advocates reform: == Chinese == === Pronunciation === === Nou [SEP] derivationally related form [SEP] reform, make changes for improvement in order to remove abuse and injustices; "reform a political system" [SEP] derivationally related form [SEP] reform, a campaign aimed to correct abuses or malpractices; "the reforms he proposed were too radical for the politicians" [SEP] hypernym [SEP] movement, a series of actions advancing a principle or tending toward a particular end; "he supported populist campaigns"; "they worked in the cause of world peace"; "the team was ready for a drive toward the pennant"; "the movement to end slavery"; "contributed to the war effort" [SEP] derivationally related form [SEP] push, exert oneself continuously, vigorously, or obtrusively to gain an end or engage in a crusade for a certain cause or person; be an advocate for; "The liberal party pushed for reforms"; "She is crusading for women\'s rights"; "The Dean is pushing for his favorite candidate": == English == === Proper noun === Push (plura [SEP]', '', '']]
[['', '', ''], ['tilt, a contentious speech act; a dispute where there is strong disagreement; "they were involved in a violent argument": == English == === Pronunciation === (Received [SEP] form related derivationally [SEP] gainsay, take exception to; "She challenged his claims": == English == === Etymology === From Middle E [SEP]', '', ''], ['make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] hypernym [SEP] make, make or cause to be or to become; "make a mess in one\'s office"; "create a furor" [SEP] form related derivationally [SEP] making, the act that results in something coming to be; "the devising of plans"; "the fashioning of pots and pans"; "the making of measurements"; "it was already in the making": == English == === Alternative forms === makei [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] hypernym [SEP] make, make or cause to be or to become; "make a mess in one\'s office"; "create a furor" [SEP] hypernym [SEP] make, create by artistic means; "create a poem"; "Schoenberg created twelve-tone music"; "Picasso created Cubism"; "Auden made verses" [SEP] form related derivationally [SEP] making, the act that results in something coming to be; "the devising of plans"; "the fashioning of pots and pans"; "the making of measurements"; "it was already in the making": == English == === Alternative forms === makei [SEP]', 'make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] form related derivationally [SEP] make, a recognizable kind; "there\'s a new brand of hero in the movies now"; "what make of car is that?" [SEP] derivationally related form [SEP] produce, create or manufacture a man-made product; "We produce more cars than we can sell"; "The company has been making toys for two centuries" [SEP] derivationally related form [SEP] making, the act that results in something coming to be; "the devising of plans"; "the fashioning of pots and pans"; "the making of measurements"; "it was already in the making": == English == === Alternative forms === makei [SEP]'], ['train, undergo training or instruction in preparation for a particular role, function, or profession; "She is training to be a teacher"; "He trained as a legal aid": == English == === Etymology 1 === From Middle [SEP] form related derivationally [SEP] preparation, preparatory school work done outside school (especially at home): == English == === Alternative forms === præpa [SEP]', '', ''], ['make, make by combining materials and parts; "this little pig made his house out of straw"; "Some eccentric constructed an electric brassiere warmer": == English == === Pronunciation === IPA(key): [SEP] form related derivationally [SEP] making, the act that results in something coming to be; "the devising of plans"; "the fashioning of pots and pans"; "the making of measurements"; "it was already in the making" [SEP] hypernym [SEP] production, the act or process of producing something; "Shakespeare\'s production of poetry was enormous"; "the production of white blood cells" [SEP] hypernym [SEP] human activity, something that people do or cause to happen [SEP] hypernym [SEP] uncovering, the act of discovering something [SEP] hypernym [SEP] finding, the act of determining the properties of something, usually by research or calculation; "the determination of molecular structures": == English == === Etymology === From Middle E [SEP]', '', '']]
[['', '', ''], ['vesica, a distensible membranous sac (usually containing liquid or gas): == English == === Etymology === Borrowed from [SEP] hypernym [SEP] gallbladder, a muscular sac attached to the liver that stores bile (secreted by the liver) until it is needed for digestion [SEP] part has [SEP] thorax, the part of the human torso between the neck and the diaphragm or the corresponding part in other vertebrates [SEP] part has [SEP] trunk, the body excluding the head and neck and limbs; "they moved their arms and legs and bodies" [SEP] has part [SEP] midriff, (anatomy) a muscular partition separating the abdominal and thoracic cavities; functions in respiration [SEP] hypernym [SEP] musculature, the muscular system of an organism: == English == === Etymology === Borrowed from [SEP]', '', ''], ['', '', ''], ['', '', ''], ['', '', '']]
[['', '', ''], ['', '', ''], ['', '', ''], ['man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] of topic domain synset [SEP] physical structure, the entire structure of an organism (an animal, plant, or human being); "he felt as if his whole body were on fire" [SEP] has part [SEP] body substance, the substance of the body [SEP] hypernym [SEP] chromatin granule, the readily stainable substance of a cell nucleus consisting of DNA and RNA and various proteins; during mitotic division it condenses into chromosomes: == English == === Etymology === From Latin lī [SEP]', '', ''], ['man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] of topic domain synset [SEP] physical structure, the entire structure of an organism (an animal, plant, or human being); "he felt as if his whole body were on fire" [SEP] has part [SEP] arm, a human limb; technically the part of the superior limb between the shoulder and the elbow but commonly used to refer to the whole superior limb: == Translingual == === Symbol === arm (inter [SEP]', 'man, any living or extinct member of the family Hominidae characterized by superior intelligence, articulate speech, and erect carriage: == English == === Pronunciation === Rhymes: [SEP] has part [SEP] pes, the part of the leg of a human being below the ankle joint; "his bare feet projected from his trousers"; "armored from head to foot" [SEP] has part [SEP] toe, one of the digits of the foot [SEP] hypernym [SEP] extremity, that part of a limb that is farthest from the torso [SEP] part has [SEP] limb, one of the jointed appendages of an animal used for locomotion or grasping: arm; leg; wing; flipper [SEP] hypernym [SEP] arm, a human limb; technically the part of the superior limb between the shoulder and the elbow but commonly used to refer to the whole superior limb: == Translingual == === Symbol === arm (inter [SEP]', '']]
[['seize, take hold of; grab; "The sales clerk quickly seized the money on the counter"; "She clutched her purse"; "The mother seized her child by the arm"; "Birds of prey often seize small mammals": == English == === Etymology === Earlier seise [SEP] form related derivationally [SEP] taking hold, the act of gripping something firmly with the hands (or the tentacles): == English == === Verb === taking hold prese [SEP]', '', ''], ['', '', ''], ['barricade, a barrier (usually thrown up hastily) to impede the advance of an enemy; "they stormed the barricade": == English == === Etymology === Borrowed from [SEP] form related derivationally [SEP] barricado, block off with barricades: == English == === Noun === barricado (plural [SEP]', '', ''], ['guidance, something that provides direction or advice as to a decision or course of action: == English == === Alternative forms === guida [SEP] form related derivationally [SEP] rede, give advice to; "The teacher counsels troubled students"; "The lawyer counselled me when I was accused of tax fraud": == English == === Etymology === From Old Engl [SEP]', '', ''], ['unionize, form or join a union; "The auto workers decided to unionize": == English == === Etymology === union +\u200e -ize [SEP] form related derivationally [SEP] unionization, act of forming labor unions; "the issue underlying the strike was unionization": == English == === Alternative forms === union [SEP]', '', '']]
First 5 train_labels:
4
2
3
4
3
train_triplets = load_triplets_with_pos_tails(os.path.join(path_dir, "ranking_train.txt"),args.mode,all_pos_tails,args.neg_sample_num_train)
print("—————————————————Train Triplets (first 5)————————————————————————————————————————————:")
for train_triplet in train_triplets[:5]:
print(train_triplet)
train_paths = load_paths(os.path.join(path_dir, "relation_paths_train.txt"),
os.path.join(path_dir, "entity_paths_train.txt"), len(train_triplets),args.max_path_num,args.mode)
print("—————————————————train_paths (first 5)————————————————————————————————————————————:")
for train_path in train_paths[:5]:
print(train_path)
valid_triplets = load_triplets_with_pos_tails(os.path.join(path_dir, "ranking_valid.txt"),args.mode,all_pos_tails,args.neg_sample_num_valid)
valid_paths = load_paths(os.path.join(path_dir, "relation_paths_valid.txt"),
os.path.join(path_dir, "entity_paths_valid.txt"), len(valid_triplets),args.max_path_num,args.mode)
ranking_triplets = load_triplets_with_pos_tails(os.path.join(path_dir, "ranking_test.txt"),args.mode,all_pos_tails,args.neg_sample_num_test)
ranking_paths = load_paths(os.path.join(path_dir, "relation_paths_test.txt"),
os.path.join(path_dir, "entity_paths_test.txt"), len(ranking_triplets),args.max_path_num,args.mode)
train_rules = load_rules(os.path.join(path_dir, "relation_rules_train.txt"),
os.path.join(path_dir, "rules_heads_train.txt"), len(train_triplets),args.max_path_num,train_triplets,args.mode)
print("—————————————————train_rules (first 5)————————————————————————————————————————————:")
for train_rule in train_rules[:5]:
print(train_rule)
valid_rules = load_rules(os.path.join(path_dir, "relation_rules_valid.txt"),
os.path.join(path_dir, "rules_heads_valid.txt"), len(valid_triplets),args.max_path_num,valid_triplets,args.mode)
ranking_rules = load_rules(os.path.join(path_dir, "relation_rules_test.txt"),
os.path.join(path_dir, "rules_heads_test.txt"), len(ranking_triplets),args.max_path_num,ranking_triplets,args.mode)
train_merged=merge_rules_and_paths(args.no_merge,train_paths,train_rules,args.neg_sample_num_train,args.max_path_num)
print("—————————————————train_merged (first 5)————————————————————————————————————————————:")
for train_merge in train_merged[:5]:
print(train_merge)
valid_merged=merge_rules_and_paths(args.no_merge,valid_paths,valid_rules,args.neg_sample_num_valid,args.max_path_num)
ranking_merged=merge_rules_and_paths(args.no_merge,ranking_paths,ranking_rules,args.neg_sample_num_test,args.max_path_num)
text,relation_texts = load_text(text_dir,args.text_file,args.text_length)
all_dict = {**text['entity'], **text['relation']}
valid_pos_tails=[all_pos_tails[t[0]][t[1]] for t in valid_triplets[::args.neg_sample_num_valid]]
ranking_pos_tails=[all_pos_tails[t[0]][t[1]] for t in ranking_triplets[::args.neg_sample_num_test]]
train_triplets,train_merged,train_labels,_=reshape_relation_prediction_ranking_data(train_triplets,train_merged,args.neg_sample_num_train,all_dict,text)
print("First 5 train_triplets:")
for triplet in train_triplets[:5]:
print(triplet)
print("\nFirst 5 train_merged:")
for merged in train_merged[:5]:
print(merged)
print("\nFirst 5 train_labels:")
for label in train_labels[:5]:
print(label)
valid_triplets,valid_merged,valid_labels,_=reshape_relation_prediction_ranking_data(valid_triplets,valid_merged,args.neg_sample_num_valid,all_dict,text)
ranking_triplets,ranking_merged,ranking_labels,ranking_indexes=reshape_relation_prediction_ranking_data(ranking_triplets,ranking_merged,args.neg_sample_num_test,all_dict,text)