-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path11 - Main.cpp
73 lines (63 loc) · 1.59 KB
/
11 - Main.cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include<iostream>
#include<vector>
#include<unordered_map>
#include "08 - BagOfWords.cpp"
#include<fstream>
int main()
{
//opening the processed data.txt file
std::ifstream in;
in.open("03 - Processed data.txt");
int index=0;
//definning the two string objects
std::string temp,line;
std::vector<std::string> row;
//storing the processed data into vector<vector<string>>
std::vector<std::vector<std::string>> processedData;
while(std::getline(in,line))
{
std::cout<<index+1<<std::endl;
index++;
temp="";
for(int i=0;i<line.size();i++)
{
if(line[i]!=',')
{
temp = temp + line[i];
}
else
{
row.push_back(temp);
temp="";
}
}
processedData.push_back(row);
row.clear();
}
// std::cout<<processedData[0].size()<<std::endl;
// std::getline(in,line);
// std::cout<<line<<std::endl;
// temp="";
// for(int i=0;i<line.size();i++)
// {
// if(line[i]!=',')
// temp+= line[i];
// else
// {
// row.push_back(temp);
// temp="";
// }
// }
// for(auto z : row)
// {
// std::cout<<z<<" ";
// }
// std::cout<<std::endl;
//4196 rows has been read
// std::cout<<processedData.size()<<std::endl;
//creating an object of the FeatureExtraction class
BagOfWords fe;
//calling the function of bagofwords to generate a csv file
fe.transform(processedData);
in.close();
}