-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVocabulary.h
More file actions
25 lines (21 loc) · 817 Bytes
/
Vocabulary.h
File metadata and controls
25 lines (21 loc) · 817 Bytes
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
#include<cstdio>
#include<unordered_map>
#include<vector>
using namespace std;
/**
* Class which keeps track of the words that appear in the data set.
* It assings a vector to each word.
*/
class Vocabulary {
unordered_map<string, vector<double>> vocabulary;
public:
Vocabulary();
~Vocabulary();
vector<double> getWordRepresentation(string word);
bool containsWord(string word);
void addNewWord(string word);
void updateWordRepresentation(string word, vector<double> newRep);
void updateWordRepresentation(string word, vector<double> newRep, double learningRate);
void updateWordRepresentation(string word, vector<double> newRep, double learningRate, double regresionParam);
vector<vector<double>> getMatrixFromVocabulary();
};