-
Notifications
You must be signed in to change notification settings - Fork 0
/
userprofile.h
64 lines (48 loc) · 1.9 KB
/
userprofile.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
55
56
57
58
59
60
61
62
63
64
#ifndef USERPROFILE_H
#define USERPROFILE_H
#include <boost/date_time/posix_time/posix_time.hpp>
#include <pqxx/pqxx>
#include "profile.h"
#include "utils.h"
#include "tweetprofile.h"
namespace casimiro {
using namespace boost::posix_time;
enum ProfileType {
HASHTAG,
BAG_OF_WORDS,
TOPICS
};
class UserProfile;
typedef std::shared_ptr<UserProfile> UserProfilePtr;
typedef std::vector<std::pair<ptime, long>> RetweetVector;
typedef std::shared_ptr<RetweetVector> RetweetVectorPtr;
class UserProfile : public Profile
{
public:
UserProfile(PqConnectionPtr _con, long _userId, ConceptMapPtr _profile, ptime _start, ptime _end, ProfileType _profileType, std::string _sqlQuery);
virtual ~UserProfile();
private:
PqConnectionPtr m_con;
long m_userId;
ConceptMapPtr m_profile;
ptime m_start;
ptime m_end;
ProfileType m_profileType;
std::string m_sqlQuery;
virtual void buildConceptMap(pqxx::result &_rows, std::string _pattern);
virtual void buildTopicsConceptMap(pqxx::result _rows);
public:
virtual TweetProfileVectorPtr getCandidateTweets(const ptime &_start, const ptime &_end);
virtual RetweetVectorPtr getRetweets(const ptime &_start, const ptime &_end);
virtual void loadProfile();
virtual double cosineSimilarity(ConceptMapPtr _profile);
virtual ConceptMapPtr getProfile() { return m_profile; }
virtual long getUserId() { return m_userId; }
virtual ptime getStart() { return m_start; }
virtual ptime getEnd() { return m_end; }
static UserProfilePtr getHashtagProfile(PqConnectionPtr _con, long _userId, ptime _start, ptime _end, bool _social);
static UserProfilePtr getBagOfWordsProfile(PqConnectionPtr _con, long _userId, ptime _start, ptime _end, bool _social);
static UserProfilePtr getTopicsProfile(PqConnectionPtr _con, long _userId, ptime _start, ptime _end, bool _social);
};
}
#endif // USERPROFILE_H