def test2(self, lang, text): errorlist = "" text = text.encode("utf-8") print text wordlist = text.split() print wordlist for word in wordlist: if word[0] != "[" and word[0] != "<": print word f = open(self.tmpdir + 'word', 'w') f.write("[sentence]\n") f.write(word) f.close() gen_grammar.createvoca( self.tmpdir + 'word', self.juliusAMPath + lang + "/" + self.PhonemsFileName, self.tmpdir + 'word') print self.tmpdir + 'word' print self.juliusAMPath + lang + "/" + self.TiedlistFileName if gen_grammar.perrors( self.tmpdir + 'word.voca', self.juliusAMPath + lang + "/" + self.TiedlistFileName) != 0: errorlist = errorlist + word + "::" errorlist = errorlist[:-2] return errorlist.upper()
def wordexist(word): f = open("tmp","w") f.write("[sentence]\n") f.write(word) f.close() vError=gen_grammar.verrors("tmp","/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/phonems") if vError==0: gengrammar.createvoca("tmp","/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/phonems","tmp1") vError=gen_grammar.perrors("tmp1.voca","/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/tiedlist") print vError return vError
def wordexist(word): f = open("tmp", "w") f.write("[sentence]\n") f.write(word) f.close() vError = gen_grammar.verrors( "tmp", "/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/phonems") if vError == 0: gengrammar.createvoca( "tmp", "/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/phonems", "tmp1") vError = gen_grammar.perrors( "tmp1.voca", "/opt/qbo/ros_stacks/qbo_apps/qbo_listen/config/AM/en/tiedlist") print vError return vError
def test2(self,lang,text): errorlist="" text=text.encode("utf-8") print text wordlist=text.split() print wordlist for word in wordlist: if word[0]!="[" and word[0]!="<": print word f = open(self.tmpdir+'word', 'w') f.write("[sentence]\n") f.write(word) f.close() gen_grammar.createvoca(self.tmpdir+'word', self.juliusAMPath+lang+"/"+self.PhonemsFileName, self.tmpdir+'word') print self.tmpdir+'word' print self.juliusAMPath+lang+"/"+self.TiedlistFileName if gen_grammar.perrors(self.tmpdir+'word.voca',self.juliusAMPath+lang+"/"+self.TiedlistFileName)!=0: errorlist=errorlist+word+"::" errorlist=errorlist[:-2] return errorlist.upper()