def synchronise_sound(self): OrgOrth=self.orth if myModule.all_of_chartypes_p(OrgOrth,['katakana']): self.orth=self.reading elif myModule.all_of_chartypes_p(OrgOrth,['hiragana']): self.orth=myModule.kana2kana_wd(self.reading) elif myModule.all_of_chartypes_p(OrgOrth,['han','hiragana']): EndSubstr='' Boundary=identify_kana_boundary(OrgOrth) EndSubstr=myModule.kana2kana_wd(self.reading[Boundary:]) TopSubstr=OrgOrth[:Boundary] self.orth=TopSubstr+EndSubstr else: self.orth=self.reading
def set_orth(self,Orth,dosound=False): self.orth=Orth if dosound: if myModule.all_of_chartypes_p(Orth,['katakana']): self.reading=Orth elif myModule.all_of_chartypes_p(Orth,['hiragana']): self.reading=myModule.kana2kana_wd(Orth) elif myModule.all_of_chartypes_p(Orth,['han','hiragana','katakana']): ShellCmd=' '.join([HomeDir+'/myProgs/scripts/kakasi_katakana.sh','"'+Orth+'"']) self.reading=subprocess.Popen(ShellCmd,shell=True,stdout=subprocess.PIPE).communicate()[0].strip().decode()