addLast.append((sayer,"said","Statement")) addLast.append(("Statement","begins_with",beginStatement)) sentence=open(path+"SemanticRoleMiner/code/input/test_input.txt","w") sentence.write(sent) sentence.close() inputFile="SemanticRoleMiner/code/input" myTestFile=SenSta(inputFile) myTestFile.makeSenna() myTestFile.makeStanf() sennafile=path+"SemanticRoleMiner/code/input"+"/sennaoutput.txt" stanfile=path+"SemanticRoleMiner/code/input"+"/stanoutput.txt" #************************************************************* #2 Senna=modifySenna(sennafile) #print Senna['sen0'] VBNs=[] for sen,val in Senna.items(): for num,token in val.items(): for a,b in token.items(): if b[1][0:2]=="VB": VBNs.append(a) #print VBNs #3 Stan=modifyStanf(stanfile) Preps={} for key,val in Stan.items(): for i, prep in val.items():
def makeSenna(self): #running senna to generate sennaoutput cmd=os.system('cd /home/kimia/srl/senna \n ./senna <'+self.inputFile+'> '+self.sennaOutFile+'output.txt') self.sennaDict=modifySenna(self.sennaOutFile+'output.txt') return self.sennaDict