summary refs log tree commit diff stats
path: root/generator/notion.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-03-31 23:05:02 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-03-31 23:05:02 -0400
commit75e947fa0021547f460496d1c3aef5b61af4c669 (patch)
tree64559a5329b3e5983ffdfe7ee2ad65c7c938e98d /generator/notion.h
parent3554df2e34e63364eea3a7998e0dfb0e6be65ca4 (diff)
downloadverbly-75e947fa0021547f460496d1c3aef5b61af4c669.tar.gz
verbly-75e947fa0021547f460496d1c3aef5b61af4c669.tar.bz2
verbly-75e947fa0021547f460496d1c3aef5b61af4c669.zip
Migrated generator to hkutil
Diffstat (limited to 'generator/notion.h')
-rw-r--r--generator/notion.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/generator/notion.h b/generator/notion.h index 817e66a..3bff916 100644 --- a/generator/notion.h +++ b/generator/notion.h
@@ -1,9 +1,9 @@
1#ifndef NOTION_H_221DE2BC 1#ifndef NOTION_H_221DE2BC
2#define NOTION_H_221DE2BC 2#define NOTION_H_221DE2BC
3 3
4#include <cassert>
5#include <list> 4#include <list>
6#include <string> 5#include <string>
6#include <hkutil/database.h>
7#include "../lib/enums.h" 7#include "../lib/enums.h"
8 8
9namespace verbly { 9namespace verbly {
@@ -43,24 +43,30 @@ namespace verbly {
43 43
44 int getWnid() const 44 int getWnid() const
45 { 45 {
46 // Calling code should always call hasWnid first. 46 if (!hasWnid_)
47 assert(hasWnid_); 47 {
48 throw std::domain_error("Notion does not have wnid");
49 }
48 50
49 return wnid_; 51 return wnid_;
50 } 52 }
51 53
52 int getNumOfImages() const 54 int getNumOfImages() const
53 { 55 {
54 // Calling code should always call hasWnid and check that the notion is a noun first. 56 if (!hasWnid_ || (partOfSpeech_ != part_of_speech::noun))
55 assert(hasWnid_ && (partOfSpeech_ == part_of_speech::noun)); 57 {
58 throw std::domain_error("Notion is not a noun with wnid");
59 }
56 60
57 return numOfImages_; 61 return numOfImages_;
58 } 62 }
59 63
60 std::list<std::string> getPrepositionGroups() const 64 std::list<std::string> getPrepositionGroups() const
61 { 65 {
62 // Calling code should always check that the notion is a preposition first. 66 if (partOfSpeech_ != part_of_speech::preposition)
63 assert(partOfSpeech_ == part_of_speech::preposition); 67 {
68 throw std::domain_error("Notion is not a preposition");
69 }
64 70
65 return prepositionGroups_; 71 return prepositionGroups_;
66 } 72 }
@@ -81,7 +87,7 @@ namespace verbly {
81 87
82 // Serializer 88 // Serializer
83 89
84 database& operator<<(database& db, const notion& arg); 90 hatkirby::database& operator<<(hatkirby::database& db, const notion& arg);
85 91
86 }; 92 };
87}; 93};