summary refs log tree commit diff stats
path: root/lib/field.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
commit6746da6edd7d9d50efe374eabbb79a3cac882d81 (patch)
treeff20917e08b08d36b9541c1371106596e7bec442 /lib/field.cpp
parent4af7e55733098ca42f75a4ffaca1b0f6bab4dd36 (diff)
downloadverbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.gz
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.bz2
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.zip
Started structural rewrite
The new object structure was designed to build on the existing WordNet
structure, while also adding in all of the data that we get from other sources.
More information about this can be found on the project wiki.

The generator has already been completely rewritten to generate a
datafile that uses the new structure. In addition, a number of indexes
are created, which does double the size of the datafile, but also allows
for much faster lookups. Finally, the new generator is written modularly
and is a lot more readable than the old one.

The verbly interface to the new object structure has mostly been
completed, but has not been tested fully. There is a completely new
search API which utilizes a lot of operator overloading; documentation
on how to use it should go up at some point.

Token processing and verb frames are currently unimplemented. Source for
these have been left in the repository for now.
Diffstat (limited to 'lib/field.cpp')
-rw-r--r--lib/field.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/field.cpp b/lib/field.cpp new file mode 100644 index 0000000..d7adbb3 --- /dev/null +++ b/lib/field.cpp
@@ -0,0 +1,91 @@
1#include "field.h"
2#include "filter.h"
3
4namespace verbly {
5
6 filter field::operator==(int value) const
7 {
8 return filter(*this, filter::comparison::int_equals, value);
9 }
10
11 filter field::operator!=(int value) const
12 {
13 return filter(*this, filter::comparison::int_does_not_equal, value);
14 }
15
16 filter field::operator<(int value) const
17 {
18 return filter(*this, filter::comparison::int_is_less_than, value);
19 }
20
21 filter field::operator<=(int value) const
22 {
23 return filter(*this, filter::comparison::int_is_at_most, value);
24 }
25
26 filter field::operator>(int value) const
27 {
28 return filter(*this, filter::comparison::int_is_greater_than, value);
29 }
30
31 filter field::operator>=(int value) const
32 {
33 return filter(*this, filter::comparison::int_is_at_least, value);
34 }
35
36 filter field::operator==(part_of_speech value) const
37 {
38 return filter(*this, filter::comparison::int_equals, static_cast<int>(value));
39 }
40
41 filter field::operator==(positioning value) const
42 {
43 return filter(*this, filter::comparison::int_equals, static_cast<int>(value));
44 }
45
46 filter field::operator==(inflection value) const
47 {
48 return filter(*this, filter::comparison::int_equals, static_cast<int>(value));
49 }
50
51 filter field::operator==(bool value) const
52 {
53 return filter(*this, filter::comparison::boolean_equals, value);
54 }
55
56 filter field::operator==(std::string value) const
57 {
58 return filter(*this, filter::comparison::string_equals, std::move(value));
59 }
60
61 filter field::operator!=(std::string value) const
62 {
63 return filter(*this, filter::comparison::string_does_not_equal, std::move(value));
64 }
65
66 filter field::operator%=(std::string value) const
67 {
68 return filter(*this, filter::comparison::string_is_like, std::move(value));
69 }
70
71 field::operator filter() const
72 {
73 return filter(*this, filter::comparison::is_not_null);
74 }
75
76 filter field::operator!() const
77 {
78 return filter(*this, filter::comparison::is_null);
79 }
80
81 filter field::operator%=(filter joinCondition) const
82 {
83 if (type_ == type::hierarchal_join)
84 {
85 return filter(*this, filter::comparison::hierarchally_matches, std::move(joinCondition));
86 } else {
87 return filter(*this, filter::comparison::matches, std::move(joinCondition));
88 }
89 }
90
91};