diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-19 14:40:21 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-03-19 14:40:21 -0400 |
commit | 02c187fd3141203024b6f359ec714c0b804583c0 (patch) | |
tree | a3944e5ed54bf1e6faea276346ac773f7623079b /generator | |
parent | 909852431ef20a6afb6716ff40577f1be806e0ca (diff) | |
download | verbly-02c187fd3141203024b6f359ec714c0b804583c0.tar.gz verbly-02c187fd3141203024b6f359ec714c0b804583c0.tar.bz2 verbly-02c187fd3141203024b6f359ec714c0b804583c0.zip |
Nouns with any uppercase letters are now considered proper
Diffstat (limited to 'generator')
-rw-r--r-- | generator/generator.cpp | 12 | ||||
-rw-r--r-- | generator/schema.sql | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/generator/generator.cpp b/generator/generator.cpp index faef5f7..de369a4 100644 --- a/generator/generator.cpp +++ b/generator/generator.cpp | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <sstream> | 10 | #include <sstream> |
11 | #include <regex> | 11 | #include <regex> |
12 | #include <list> | 12 | #include <list> |
13 | #include <algorithm> | ||
13 | #include "progress.h" | 14 | #include "progress.h" |
14 | 15 | ||
15 | struct verb { | 16 | struct verb { |
@@ -525,9 +526,9 @@ int main(int argc, char** argv) | |||
525 | { | 526 | { |
526 | if (nouns.count(word) == 1) | 527 | if (nouns.count(word) == 1) |
527 | { | 528 | { |
528 | query = "INSERT INTO nouns (singular, plural) VALUES (?, ?)"; | 529 | query = "INSERT INTO nouns (singular, proper, plural) VALUES (?, ?, ?)"; |
529 | } else { | 530 | } else { |
530 | query = "INSERT INTO nouns (singular) VALUES (?)"; | 531 | query = "INSERT INTO nouns (singular, proper) VALUES (?, ?)"; |
531 | } | 532 | } |
532 | 533 | ||
533 | break; | 534 | break; |
@@ -576,9 +577,14 @@ int main(int argc, char** argv) | |||
576 | { | 577 | { |
577 | case 1: // Noun | 578 | case 1: // Noun |
578 | { | 579 | { |
580 | auto sing = nouns[word].singular; | ||
581 | sqlite3_bind_int(ppstmt, 2, (std::any_of(std::begin(sing), std::end(sing), [] (char ch) { | ||
582 | return isupper(ch); | ||
583 | }) ? 1 : 0)); | ||
584 | |||
579 | if (nouns.count(word) == 1) | 585 | if (nouns.count(word) == 1) |
580 | { | 586 | { |
581 | sqlite3_bind_text(ppstmt, 2, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); | 587 | sqlite3_bind_text(ppstmt, 3, nouns[word].plural.c_str(), nouns[word].plural.length(), SQLITE_STATIC); |
582 | } | 588 | } |
583 | 589 | ||
584 | break; | 590 | break; |
diff --git a/generator/schema.sql b/generator/schema.sql index b4efe0a..8e1e822 100644 --- a/generator/schema.sql +++ b/generator/schema.sql | |||
@@ -52,7 +52,8 @@ DROP TABLE IF EXISTS `nouns`; | |||
52 | CREATE TABLE `nouns` ( | 52 | CREATE TABLE `nouns` ( |
53 | `noun_id` INTEGER PRIMARY KEY, | 53 | `noun_id` INTEGER PRIMARY KEY, |
54 | `singular` VARCHAR(32) NOT NULL, | 54 | `singular` VARCHAR(32) NOT NULL, |
55 | `plural` VARCHAR(32) | 55 | `plural` VARCHAR(32), |
56 | `proper` INTEGER(1) NOT NULL | ||
56 | ); | 57 | ); |
57 | 58 | ||
58 | DROP TABLE IF EXISTS `hypernymy`; | 59 | DROP TABLE IF EXISTS `hypernymy`; |