Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import re
import sentenceSceneMap
summaryScriptAlignment = dict()
def openFiles(path):
scriptProcess = sentenceSceneMap.ScriptSentenceMapExtractor(path)
sentSceneMap = scriptProcess.extractSentenceMap()
alignmentFile = open(path + 'al_wiki_script.txt', 'r')
sceneSentenceMap = open(path + 'sceneSentenceMap.txt', 'r')
return alignmentFile, sceneSentenceMap, sentSceneMap
def addScriptSentenceNum(summarySentenceNum, scriptSentenceNum, sentSceneMap):
if not (summarySentenceNum in summaryScriptAlignment):
summaryScriptAlignment[summarySentenceNum] = set()
summaryScriptAlignment[summarySentenceNum].add(scriptSentenceNum)
def processAlignment(path):
alignmentFile, sceneSentenceMap, sentSceneMap = openFiles(path)
for line in alignmentFile:
aligned = re.search('\t([0-9]*)', line)
summarySentenceNum = re.search('([0-9]*)/p_', line)
scriptSentenceNum = re.search('-([0-9]*)/', line)
if aligned and aligned.group(1) != '0':
addScriptSentenceNum(int(summarySentenceNum.group(1)), scriptSentenceNum.group(1), sentSceneMap)
"""
alignment = []
count = 0
for key in summaryScriptAlignment:
alignment.append([])
for element in summaryScriptAlignment[key]:
alignment[count].append(element)
count += 1
"""
#print(summaryScriptAlignment)
return summaryScriptAlignment, sentSceneMap
#print(alignment)