summary refs log tree commit diff stats
path: root/lib/word.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-03-24 23:16:07 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-03-24 23:16:07 -0400
commiteef5de613c75661e5d94baa086f6f2ddc26c7ed0 (patch)
tree180230f6a245c5bca94d894273f5d2b93ded3f04 /lib/word.cpp
parentd5ee4e39e5b5b3b8daa85cd972802195ad35e965 (diff)
downloadverbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.tar.gz
verbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.tar.bz2
verbly-eef5de613c75661e5d94baa086f6f2ddc26c7ed0.zip
Added verb frames
In addition:
- Added prepositions.
- Rewrote a lot of the query interface. It now, for a lot of relationships, supports nested AND, OR, and NOT logic.
- Rewrote the token class. It is now a union-like class instead of being polymorphic, which means smart pointers are no longer necessary.
- Querying with regards to word derivation has been temporarily removed.
- Sentinel values are now supported for all word types.
- The VerbNet data retrieved from http://verbs.colorado.edu/~mpalmer/projects/verbnet/downloads.html was found to not be perfectly satisfactory in some regards, especially regarding adjective phrases. A patch file is now included in the repository describing the changes made to the VerbNet v3.2 download for the canonical verbly datafile.
Diffstat (limited to 'lib/word.cpp')
-rw-r--r--lib/word.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/word.cpp b/lib/word.cpp index 15af150..13c611f 100644 --- a/lib/word.cpp +++ b/lib/word.cpp
@@ -3,13 +3,20 @@
3 3
4namespace verbly { 4namespace verbly {
5 5
6 word::word(const data& _data, int _id) : _data(_data), _id(_id) 6 word::word()
7 {
8
9 }
10
11 word::word(const data& _data, int _id) : _data(&_data), _id(_id), _valid(true)
7 { 12 {
8 13
9 } 14 }
10 15
11 std::list<std::string> word::rhyme_phonemes() const 16 std::list<std::string> word::rhyme_phonemes() const
12 { 17 {
18 assert(_valid == true);
19
13 std::list<std::string> result; 20 std::list<std::string> result;
14 21
15 for (auto pronunciation : pronunciations) 22 for (auto pronunciation : pronunciations)
@@ -32,6 +39,8 @@ namespace verbly {
32 39
33 bool word::starts_with_vowel_sound() const 40 bool word::starts_with_vowel_sound() const
34 { 41 {
42 assert(_valid == true);
43
35 if (pronunciations.size() > 0) 44 if (pronunciations.size() > 0)
36 { 45 {
37 return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list<std::string> phonemes) { 46 return std::any_of(std::begin(pronunciations), std::end(pronunciations), [] (std::list<std::string> phonemes) {