From 64f26d4a3b80969e08a607f80dde87d49ad5c2e3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 3 Feb 2023 09:15:28 -0500 Subject: Added word frequency information --- generator/form.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'generator/form.cpp') diff --git a/generator/form.cpp b/generator/form.cpp index a88363b..460469f 100644 --- a/generator/form.cpp +++ b/generator/form.cpp @@ -28,17 +28,22 @@ namespace verbly { { // Serialize the form first. { - db.insertIntoTable( - "forms", - { - { "form_id", arg.getId() }, - { "form", arg.getText() }, - { "complexity", arg.getComplexity() }, - { "proper", arg.isProper() }, - { "length", arg.getLength() }, - { "anagram_set_id", arg.getAnagramSetId() }, - { "reverse_form_id", arg.getReverseId() } - }); + std::list fields = { + { "form_id", arg.getId() }, + { "form", arg.getText() }, + { "complexity", arg.getComplexity() }, + { "proper", arg.isProper() }, + { "length", arg.getLength() }, + { "anagram_set_id", arg.getAnagramSetId() }, + { "reverse_form_id", arg.getReverseId() } + }; + + if (arg.getFrequency() > 0) + { + fields.emplace_back("frequency", arg.getFrequency()); + } + + db.insertIntoTable("forms", std::move(fields)); } // Then, serialize the form/pronunciation relationship. -- cgit 1.4.1