summary refs log tree commit diff stats
path: root/generator/generator.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-03-30 09:59:48 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-03-30 09:59:48 -0400
commit3554df2e34e63364eea3a7998e0dfb0e6be65ca4 (patch)
treee82ccb7eb257adde7d7df2b2295975ed81f137b5 /generator/generator.cpp
parent84bae572d353b03ecb3498df83ba301a456b6c6f (diff)
downloadverbly-3554df2e34e63364eea3a7998e0dfb0e6be65ca4.tar.gz
verbly-3554df2e34e63364eea3a7998e0dfb0e6be65ca4.tar.bz2
verbly-3554df2e34e63364eea3a7998e0dfb0e6be65ca4.zip
Started migrating to hkutil (does not build)
Diffstat (limited to 'generator/generator.cpp')
-rw-r--r--generator/generator.cpp161
1 files changed, 90 insertions, 71 deletions
diff --git a/generator/generator.cpp b/generator/generator.cpp index d774bd9..e34ca69 100644 --- a/generator/generator.cpp +++ b/generator/generator.cpp
@@ -594,7 +594,12 @@ namespace verbly {
594 fields.emplace_back("major", DATABASE_MAJOR_VERSION); 594 fields.emplace_back("major", DATABASE_MAJOR_VERSION);
595 fields.emplace_back("minor", DATABASE_MINOR_VERSION); 595 fields.emplace_back("minor", DATABASE_MINOR_VERSION);
596 596
597 db_.insertIntoTable("version", std::move(fields)); 597 db_.insertIntoTable(
598 "version",
599 {
600 { "major", DATABASE_MAJOR_VERSION },
601 { "minor", DATABASE_MINOR_VERSION }
602 });
598 } 603 }
599 604
600 void generator::dumpObjects() 605 void generator::dumpObjects()
@@ -689,11 +694,12 @@ namespace verbly {
689 word& word1 = *wordByWnidAndWnum_.at(lookup1); 694 word& word1 = *wordByWnidAndWnum_.at(lookup1);
690 word& word2 = *wordByWnidAndWnum_.at(lookup2); 695 word& word2 = *wordByWnidAndWnum_.at(lookup2);
691 696
692 std::list<field> fields; 697 db_.insertIntoTable(
693 fields.emplace_back("antonym_1_id", word1.getId()); 698 "antonymy",
694 fields.emplace_back("antonym_2_id", word2.getId()); 699 {
695 700 { "antonym_1_id", word1.getId() },
696 db_.insertIntoTable("antonymy", std::move(fields)); 701 { "antonym_2_id", word2.getId() }
702 });
697 } 703 }
698 } 704 }
699 } 705 }
@@ -721,11 +727,12 @@ namespace verbly {
721 notion& notion1 = *notionByWnid_.at(lookup1); 727 notion& notion1 = *notionByWnid_.at(lookup1);
722 notion& notion2 = *notionByWnid_.at(lookup2); 728 notion& notion2 = *notionByWnid_.at(lookup2);
723 729
724 std::list<field> fields; 730 db_.insertIntoTable(
725 fields.emplace_back("noun_id", notion1.getId()); 731 "variation",
726 fields.emplace_back("adjective_id", notion2.getId()); 732 {
727 733 { "noun_id", notion1.getId() }
728 db_.insertIntoTable("variation", std::move(fields)); 734 { "adjective_id", notion2.getId() }
735 });
729 } 736 }
730 } 737 }
731 } 738 }
@@ -786,11 +793,12 @@ namespace verbly {
786 { 793 {
787 for (int word2 : rightJoin) 794 for (int word2 : rightJoin)
788 { 795 {
789 std::list<field> fields; 796 db_.insertIntoTable(
790 fields.emplace_back("term_id", word1); 797 table_name,
791 fields.emplace_back("domain_id", word2); 798 {
792 799 { "term_id", word1 },
793 db_.insertIntoTable(table_name, std::move(fields)); 800 { "domain_id", word2 }
801 });
794 } 802 }
795 } 803 }
796 } 804 }
@@ -819,11 +827,12 @@ namespace verbly {
819 notion& notion1 = *notionByWnid_.at(lookup1); 827 notion& notion1 = *notionByWnid_.at(lookup1);
820 notion& notion2 = *notionByWnid_.at(lookup2); 828 notion& notion2 = *notionByWnid_.at(lookup2);
821 829
822 std::list<field> fields; 830 db_.insertIntoTable(
823 fields.emplace_back("effect_id", notion1.getId()); 831 "causality",
824 fields.emplace_back("cause_id", notion2.getId()); 832 {
825 833 { "effect_id", notion1.getId() },
826 db_.insertIntoTable("causality", std::move(fields)); 834 { "cause_id", notion2.getId() }
835 });
827 } 836 }
828 } 837 }
829 } 838 }
@@ -851,11 +860,12 @@ namespace verbly {
851 notion& notion1 = *notionByWnid_.at(lookup1); 860 notion& notion1 = *notionByWnid_.at(lookup1);
852 notion& notion2 = *notionByWnid_.at(lookup2); 861 notion& notion2 = *notionByWnid_.at(lookup2);
853 862
854 std::list<field> fields; 863 db_.insertIntoTable(
855 fields.emplace_back("given_id", notion1.getId()); 864 "entailment",
856 fields.emplace_back("entailment_id", notion2.getId()); 865 {
857 866 { "given_id", notion1.getId() },
858 db_.insertIntoTable("entailment", std::move(fields)); 867 { "entailment_id", notion2.getId() }
868 });
859 } 869 }
860 } 870 }
861 } 871 }
@@ -883,11 +893,12 @@ namespace verbly {
883 notion& notion1 = *notionByWnid_.at(lookup1); 893 notion& notion1 = *notionByWnid_.at(lookup1);
884 notion& notion2 = *notionByWnid_.at(lookup2); 894 notion& notion2 = *notionByWnid_.at(lookup2);
885 895
886 std::list<field> fields; 896 db_.insertIntoTable(
887 fields.emplace_back("hyponym_id", notion1.getId()); 897 "hypernymy",
888 fields.emplace_back("hypernym_id", notion2.getId()); 898 {
889 899 { "hyponym_id", notion1.getId() },
890 db_.insertIntoTable("hypernymy", std::move(fields)); 900 { "hypernym_id", notion2.getId() }
901 });
891 } 902 }
892 } 903 }
893 } 904 }
@@ -915,11 +926,12 @@ namespace verbly {
915 notion& notion1 = *notionByWnid_.at(lookup1); 926 notion& notion1 = *notionByWnid_.at(lookup1);
916 notion& notion2 = *notionByWnid_.at(lookup2); 927 notion& notion2 = *notionByWnid_.at(lookup2);
917 928
918 std::list<field> fields; 929 db_.insertIntoTable(
919 fields.emplace_back("instance_id", notion1.getId()); 930 "instantiation",
920 fields.emplace_back("class_id", notion2.getId()); 931 {
921 932 { "instance_id", notion1.getId() },
922 db_.insertIntoTable("instantiation", std::move(fields)); 933 { "class_id", notion2.getId() }
934 });
923 } 935 }
924 } 936 }
925 } 937 }
@@ -947,11 +959,12 @@ namespace verbly {
947 notion& notion1 = *notionByWnid_.at(lookup1); 959 notion& notion1 = *notionByWnid_.at(lookup1);
948 notion& notion2 = *notionByWnid_.at(lookup2); 960 notion& notion2 = *notionByWnid_.at(lookup2);
949 961
950 std::list<field> fields; 962 db_.insertIntoTable(
951 fields.emplace_back("holonym_id", notion1.getId()); 963 "member_meronymy",
952 fields.emplace_back("meronym_id", notion2.getId()); 964 {
953 965 { "holonym_id", notion1.getId() },
954 db_.insertIntoTable("member_meronymy", std::move(fields)); 966 { "meronym_id", notion2.getId() }
967 });
955 } 968 }
956 } 969 }
957 } 970 }
@@ -979,11 +992,12 @@ namespace verbly {
979 notion& notion1 = *notionByWnid_.at(lookup1); 992 notion& notion1 = *notionByWnid_.at(lookup1);
980 notion& notion2 = *notionByWnid_.at(lookup2); 993 notion& notion2 = *notionByWnid_.at(lookup2);
981 994
982 std::list<field> fields; 995 db_.insertIntoTable(
983 fields.emplace_back("holonym_id", notion1.getId()); 996 "part_meronymy",
984 fields.emplace_back("meronym_id", notion2.getId()); 997 {
985 998 { "holonym_id", notion1.getId() },
986 db_.insertIntoTable("part_meronymy", std::move(fields)); 999 { "meronym_id", notion2.getId() }
1000 });
987 } 1001 }
988 } 1002 }
989 } 1003 }
@@ -1011,11 +1025,12 @@ namespace verbly {
1011 notion& notion1 = *notionByWnid_.at(lookup1); 1025 notion& notion1 = *notionByWnid_.at(lookup1);
1012 notion& notion2 = *notionByWnid_.at(lookup2); 1026 notion& notion2 = *notionByWnid_.at(lookup2);
1013 1027
1014 std::list<field> fields; 1028 db_.insertIntoTable(
1015 fields.emplace_back("holonym_id", notion1.getId()); 1029 "substance_meronymy",
1016 fields.emplace_back("meronym_id", notion2.getId()); 1030 {
1017 1031 { "holonym_id", notion1.getId() },
1018 db_.insertIntoTable("substance_meronymy", std::move(fields)); 1032 { "meronym_id", notion2.getId() }
1033 });
1019 } 1034 }
1020 } 1035 }
1021 } 1036 }
@@ -1045,18 +1060,20 @@ namespace verbly {
1045 1060
1046 if (word1.getNotion().getPartOfSpeech() == part_of_speech::adjective) 1061 if (word1.getNotion().getPartOfSpeech() == part_of_speech::adjective)
1047 { 1062 {
1048 std::list<field> fields; 1063 db_.insertIntoTable(
1049 fields.emplace_back("pertainym_id", word1.getId()); 1064 "pertainymy",
1050 fields.emplace_back("noun_id", word2.getId()); 1065 {
1051 1066 { "pertainym_id", word1.getId() },
1052 db_.insertIntoTable("pertainymy", std::move(fields)); 1067 { "noun_id", word2.getId() }
1068 });
1053 } else if (word1.getNotion().getPartOfSpeech() == part_of_speech::adverb) 1069 } else if (word1.getNotion().getPartOfSpeech() == part_of_speech::adverb)
1054 { 1070 {
1055 std::list<field> fields; 1071 db_.insertIntoTable(
1056 fields.emplace_back("mannernym_id", word1.getId()); 1072 "mannernymy",
1057 fields.emplace_back("adjective_id", word2.getId()); 1073 {
1058 1074 { "mannernym_id", word1.getId() },
1059 db_.insertIntoTable("mannernymy", std::move(fields)); 1075 { "adjective_id", word2.getId() }
1076 });
1060 } 1077 }
1061 } 1078 }
1062 } 1079 }
@@ -1085,11 +1102,12 @@ namespace verbly {
1085 word& word1 = *wordByWnidAndWnum_.at(lookup1); 1102 word& word1 = *wordByWnidAndWnum_.at(lookup1);
1086 word& word2 = *wordByWnidAndWnum_.at(lookup2); 1103 word& word2 = *wordByWnidAndWnum_.at(lookup2);
1087 1104
1088 std::list<field> fields; 1105 db_.insertIntoTable(
1089 fields.emplace_back("general_id", word1.getId()); 1106 "specification",
1090 fields.emplace_back("specific_id", word2.getId()); 1107 {
1091 1108 { "general_id", word1.getId() },
1092 db_.insertIntoTable("specification", std::move(fields)); 1109 { "specific_id", word2.getId() }
1110 });
1093 } 1111 }
1094 } 1112 }
1095 } 1113 }
@@ -1117,11 +1135,12 @@ namespace verbly {
1117 notion& notion1 = *notionByWnid_.at(lookup1); 1135 notion& notion1 = *notionByWnid_.at(lookup1);
1118 notion& notion2 = *notionByWnid_.at(lookup2); 1136 notion& notion2 = *notionByWnid_.at(lookup2);
1119 1137
1120 std::list<field> fields; 1138 db_.insertIntoTable(
1121 fields.emplace_back("adjective_1_id", notion1.getId()); 1139 "similarity",
1122 fields.emplace_back("adjective_2_id", notion2.getId()); 1140 {
1123 1141 { "adjective_1_id", notion1.getId() },
1124 db_.insertIntoTable("similarity", std::move(fields)); 1142 { "adjective_2_id", notion2.getId() }
1143 });
1125 } 1144 }
1126 } 1145 }
1127 } 1146 }