-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetVectorizedData.py
More file actions
27 lines (22 loc) · 1.07 KB
/
Copy pathgetVectorizedData.py
File metadata and controls
27 lines (22 loc) · 1.07 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
#!/usr/bin/env python
# (C) Copyright 2019-2020, PwC
#
# @brief vectorising content and content summary using Universal Sentence Encoder
from framework.dfToVector.dfColumnToVect import dfColumnToVect
from framework.commonConstants import *
import pandas as pd
from os.path import join
from config import dataframeWithSummary, rootDir, dataframeWithVector, encoderURL
dfPath = join(rootDir, dataframeWithSummary + PKL)
def readRawDataAddIntoDataframe(dfPath, encoderURL, downloadPath, vectorizedDataframe):
df = pd.read_pickle(dfPath)
dataObject = dfColumnToVect(dataframe=df,
encoderURL=encoderURL)
df = dfColumnToVect.contentToVector(dataObject)
df = dfColumnToVect(dataframe=df, encoderURL=encoderURL).addKeywordVectorTodf()
df.to_pickle(join(downloadPath, vectorizedDataframe + PKL))
if __name__ == '__main__':
readRawDataAddIntoDataframe(dfPath=dfPath,
encoderURL=encoderURL,
downloadPath=rootDir,
vectorizedDataframe=dataframeWithVector)