29 lines
744 B
Python
29 lines
744 B
Python
from storageUpload import getMongoCollection
|
|
|
|
|
|
mongoUri = "mongodb://speechRecoUser:speech!reco@localhost/archSpeechReco"
|
|
dbName = "archSpeechReco"
|
|
colName = "moviesMeta"
|
|
|
|
|
|
col = getMongoCollection(colName,dbName,mongoUri)
|
|
|
|
pipeline = [{'$match': {'gcTextReco.words': {'$exists': True}}}, {'$project': {'gcTextReco.words': 1}}]
|
|
col.aggregate(pipeline)
|
|
|
|
|
|
words = col.aggregate(pipeline)
|
|
words_dict = dict()
|
|
for w in words:
|
|
ww = w['gcTextReco']['words']
|
|
words_dict[w['_id']] = " ".join([ e['word'] for e in ww ])
|
|
|
|
|
|
for key, value in words_dict.items():
|
|
try:
|
|
col.update_one({"_id": key},{"$set":{"gcTextReco.transcript_fix":value}})
|
|
except Exception as e:
|
|
print(e)
|
|
else:
|
|
print(f"mongo update OK {key}")
|