/
Sound.h
54 lines (37 loc) · 1.15 KB
/
Sound.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef UNTITLED_SOUND_H
#define UNTITLED_SOUND_H
#include <fstream>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
class Sound {
private:
bool vowel;
string sourceString; // ex: "IY1" "M" "UW2"
string soundSymbol; // ex: "IY" "M" "UW"
int variationNumber; // ex: 1 0 2 note: 0 for all non-vowels
string type; // ex: "vowel" "stop" "fricative"
Sound(); // private constructor
static map<string, Sound> knownSounds;
static map<string, string> parseTypes();
public:
static const Sound& getSound(string);
// These will be the most useful functions for RhymeBot
const bool& isVowel() const;
bool operator==(const Sound &that) const;
bool operator!=(const Sound &that) const;
// These functions can be used if needed
const string& getSourceString() const;
const string& getSoundSymbol() const;
const int& getVariationNumber() const;
const string& getType() const;
static void init();
};
ostream& operator<<(ostream &stream, const Sound &sound);
#endif //UNTITLED_SOUND_H