コード例 #1
0
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   
コード例 #2
0
 def test1(self,lang,text):
     text=text.encode("utf-8")
     f = open(self.tmpdir+'LModel', 'w')
     f.write(text)
     f.close()
     words=gen_grammar.verrors(self.tmpdir+'LModel',self.juliusAMPath+lang+"/"+self.PhonemsFileName)
     if words==0:
          return ""
     else:
         wordsList=""
         for word in words:
             wordsList=wordsList+word+"::"
         wordsList=wordsList[:-2]
         return wordsList
コード例 #3
0
 def test1(self, lang, text):
     text = text.encode("utf-8")
     f = open(self.tmpdir + 'LModel', 'w')
     f.write(text)
     f.close()
     words = gen_grammar.verrors(
         self.tmpdir + 'LModel',
         self.juliusAMPath + lang + "/" + self.PhonemsFileName)
     if words == 0:
         return ""
     else:
         wordsList = ""
         for word in words:
             wordsList = wordsList + word + "::"
         wordsList = wordsList[:-2]
         return wordsList
コード例 #4
0
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