summary refs log tree commit diff stats
path: root/lib/database.h
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/database.h
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/database.h')
-rw-r--r--lib/database.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/database.h b/lib/database.h new file mode 100644 index 0000000..d68c40b --- /dev/null +++ b/lib/database.h
@@ -0,0 +1,73 @@
1#ifndef DATABASE_H_0B0A47D2
2#define DATABASE_H_0B0A47D2
3
4#include <string>
5#include <exception>
6#include <list>
7#include "notion.h"
8#include "word.h"
9#include "group.h"
10#include "frame.h"
11#include "lemma.h"
12#include "form.h"
13#include "pronunciation.h"
14
15struct sqlite3;
16
17namespace verbly {
18
19 template <typename Object>
20 class query;
21
22 class database {
23 public:
24
25 // Constructor
26
27 explicit database(std::string path);
28
29 // Disable copying
30
31 database(const database& other) = delete;
32 database& operator=(const database& other) = delete;
33
34 // Move constructor and move assignment
35
36 database(database&& other);
37 database& operator=(database&& other);
38
39 // Swap
40
41 friend void swap(database& first, database& second);
42
43 // Destructor
44
45 ~database();
46
47 // Queries
48
49 query<notion> notions(filter where, bool random = true, int limit = 1) const;
50
51 query<word> words(filter where, bool random = true, int limit = 1) const;
52
53 query<group> groups(filter where, bool random = true, int limit = 1) const;
54
55 query<frame> frames(filter where, bool random = true, int limit = 1) const;
56
57 query<lemma> lemmas(filter where, bool random = true, int limit = 1) const;
58
59 query<form> forms(filter where, bool random = true, int limit = 1) const;
60
61 query<pronunciation> pronunciations(filter where, bool random = true, int limit = 1) const;
62
63 private:
64
65 database() = default;
66
67 sqlite3* ppdb_ = nullptr;
68
69 };
70
71};
72
73#endif /* end of include guard: DATABASE_H_0B0A47D2 */