def parse(self, text, rubyType, rubyKana=False): """ @param rubyType str @param* rubyKana bool @yield (unicode surface, unicode ruby, unicode feature) or return None """ tr = dictman.manager( ).translateJapanese if self.__d.translateEnabled and dictman.manager( ).japaneseTranslateLanguages() else None try: return self.__d.getParser().iterparseToRuby( text, rubyType, tr=tr, show_ruby_kana=rubyKana) except Exception, e: dwarn(e)
def renderKorean(self, text): """ @param text unicode @return unicode """ ret = "" if self._renderMutex.tryLock(): ret = dictman.manager().renderKorean(text) self._renderMutex.unlock() else: dwarn("ignore thread contention") return ret
def renderJapanese(self, text): """ @param text unicode @return unicode """ ret = "" feature = GrimoireBean.instance.lookupFeature(text) if self._renderMutex.tryLock(): ret = skthreads.runsync(partial( dictman.manager().renderJapanese, text, exact=True,feature=feature)) # do exact match for speed self._renderMutex.unlock() else: dwarn("ignore thread contention") return ret
def submit(self): t = self._getInputText() if t: h = dictman.manager().renderJapanese(t) self.resultEdit.setHtml(h)
def render_hanzi(self, text): import dictman return '\n'.join(dictman.manager().renderHanzi(text))