-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureExtractor.py
More file actions
35 lines (26 loc) · 1.21 KB
/
FeatureExtractor.py
File metadata and controls
35 lines (26 loc) · 1.21 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
# @author Salvador Orozco Villalever - A07104218
# @version 02/02/2019
from JSONHandler import JSONHandler
# Abstract class representing feature extractors
class FeatureExtractor:
# Constructor of the class
def __init__(self, dataSetFilePath, requestIntervalSeconds, apiKeyName=None, pathToApiKeyFile=None, tweetList=[]):
# Name of the API key in the secret JSON file
self.apiKeyName = apiKeyName
# Path to the secret JSON file
self.pathToApiKeyFile = pathToApiKeyFile
# API key stored in the secret JSON file
if self.apiKeyName != None and self.pathToApiKeyFile != None:
self.apiKey = self.readAPIKey()
# Path to the data set file
self.dataSetFilePath = dataSetFilePath
# Interval between requests in seconds
self.requestIntervalSeconds = requestIntervalSeconds
# List of tweets whose features are to be extracted
self.tweetList = tweetList
# Abstract method for actually extracting the features
def extractFeatures(self):
pass
# Method for reading the API key from a JSON file
def readAPIKey(self):
return JSONHandler.readKeyValue(self.pathToApiKeyFile, self.apiKeyName)