summary refs log tree commit diff stats
path: root/generator/pronunciation.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 /generator/pronunciation.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 'generator/pronunciation.h')
-rw-r--r--generator/pronunciation.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/generator/pronunciation.h b/generator/pronunciation.h new file mode 100644 index 0000000..81be6c4 --- /dev/null +++ b/generator/pronunciation.h
@@ -0,0 +1,82 @@
1#ifndef PRONUNCIATION_H_584A08DD
2#define PRONUNCIATION_H_584A08DD
3
4#include <string>
5#include <cassert>
6
7namespace verbly {
8 namespace generator {
9
10 class database;
11
12 class pronunciation {
13 public:
14
15 // Constructor
16
17 explicit pronunciation(std::string phonemes);
18
19 // Accessors
20
21 int getId() const
22 {
23 return id_;
24 }
25
26 std::string getPhonemes() const
27 {
28 return phonemes_;
29 }
30
31 bool hasRhyme() const
32 {
33 return !rhyme_.empty();
34 }
35
36 std::string getRhymePhonemes() const
37 {
38 // Calling code should always call hasRhyme first.
39 assert(!rhyme_.empty());
40
41 return rhyme_;
42 }
43
44 std::string getPrerhyme() const
45 {
46 // Calling code should always call hasRhyme first.
47 assert(!rhyme_.empty());
48
49 return prerhyme_;
50 }
51
52 int getSyllables() const
53 {
54 return syllables_;
55 }
56
57 std::string getStress() const
58 {
59 return stress_;
60 }
61
62 private:
63
64 static int nextId_;
65
66 const int id_;
67 const std::string phonemes_;
68 std::string rhyme_;
69 std::string prerhyme_;
70 int syllables_ = 0;
71 std::string stress_;
72
73 };
74
75 // Serializer
76
77 database& operator<<(database& db, const pronunciation& arg);
78
79 };
80};
81
82#endif /* end of include guard: PRONUNCIATION_H_584A08DD */