-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclickbaitanalyzer.cpp
More file actions
82 lines (57 loc) · 1.63 KB
/
clickbaitanalyzer.cpp
File metadata and controls
82 lines (57 loc) · 1.63 KB
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
74
75
76
77
78
79
80
81
82
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int checkHeadline(string headline) {
ifstream headlineFile("headlineterms.txt");
string temp;
int count=0;
//adjust "i<=100" below to match your data size
for (int i = 0; i <= 100; i++) {
headlineFile >> temp;
if (headline.find(temp) != string::npos) {
count++;
}
}
return count;
}
int checkDomain(string domain) {
ifstream domainFile("domains.txt");
string temp;
int percent=0;
//adjust "i<=100" below to match your data size
for (int i = 0; i <= 100; i++) {
domainFile >> temp;
if (domain.find(temp) != string::npos) {
domainFile >> percent;
}
}
return percent;
}
int main()
{
string headline, domain, anykey;
cout << "Enter headline."<< endl;
getline(cin, headline);
cout << "Enter domain (example: 'time' or 'cnn')." << endl;
cin >> domain;
//adjust sensativity parameters here
if ((checkHeadline(headline) == 0) && (checkDomain(domain) == 0)) {
cout << "Cannot determine." << endl;
}
else if (checkHeadline(headline) >= 0 && checkDomain(domain) >= 0 && checkDomain(domain) < 50) {
cout << "Maybe" << endl;
}
else if (checkHeadline(headline) >= 0 && checkDomain(domain) >= 50 && checkDomain(domain) < 75) {
cout << "Likely" << endl;
}
else if (checkHeadline(headline) >= 0 && checkDomain(domain) >= 75) {
cout << "Most Likely" << endl;
}
else if (checkHeadline(headline) >= 1 && checkDomain(domain) >= 75) {
cout << "Absolutley" << endl;
}
cout << "Enter any key to end." << endl;
cin >> anykey;
return 0;
}