python - Unicode 到 Kruti Dev 010
问题描述
如何将 unicode 转换为 Kruti Dev 010?
我正在使用 python 语音识别库将语音转换为文本并使用 tkinter Text 小部件显示它,但它没有在 Kruti Dev 中显示。
# class variable
__thisTextArea = Text(__root)
Font_tuple = font.Font(family='Kruti Dev 010', size=16)
# inside constructor
self.__thisTextArea.config(font = self.Font_tuple, yscrollcommand=self.__thisScrollBar.set)
# inside speech recognition function
self.__thisTextArea.insert(INSERT, text_obtained)
self.__thisTextArea.insert(END,' ')
此外,在保存文件时,语音识别的文本不会被保存,但输入的文本会被保存。
解决方案
我对 tkinter 或 devanagari 都不够熟悉,无法判断这是否有帮助,但我发现了另一个项目,它有一对双向映射的函数;这是你想要的?
https://github.com/jmcmanu2/python_practice/blob/master/Unicode%20KrutiDev%20converter.py上的代码没有明确的许可证,所以我不喜欢在这里发布它,但我有一个稍微更新的版本暂时在https://gist.github.com/tripleee/b82a79f5b3e57dc6a487ae45077cdbd3上的 Python 3 的要点。(原来的版本几乎已经是 Python 3,因此所需的调整很少,尽管我删除了处理 Excel 文件的不相关部分。)
使用该代码作为import
,这是否符合您的要求?
from unicode2krutidev import Unicode_to_KrutiDev
# ...
class something:
__thisTextArea = Text(__root)
Font_tuple = font.Font(family='Kruti Dev 010', size=16)
def __init__(self, ...):
# ...
self.__thisTextArea.config(font = self.Font_tuple, yscrollcommand=self.__thisScrollBar.set)
# ...
def recognize_speech(self, ...):
# ...
text_converted = Unicode_to_KrutiDev(text_obtained)
self.__thisTextArea.insert(INSERT, text_converted)
self.__thisTextArea.insert(END,' ')
# ...
self.save_to_database(text_obtained)
推荐阅读
- html - ASP.NET Core - 为 SPA 提供不同的 HTML 文件?
- python-3.x - 执行snakemake规则作为最后一条规则
- node.js - 错误 [ERR_STREAM_CANNOT_PIPE]:无法管道,无法读取 nodejs
- c++ - 将可变参数从一个函数传递到另一个函数
- firebase - Firebase 只允许云函数访问读写
- android - 你如何 adb 到多实例 bluestacks 4?辅助实例的 adb-port 是什么?
- angular - 为什么 CKEditor 4 Angular 模块表单字段验证不起作用?
- azure - 强制 Powershell 将重复值添加到主报告表中
- google-apps-script - Google 脚本中的 .getValues() 返回非数组对象 - 导致“TypeError:无法从未定义中读取属性“0”。”
- c# - 如何从datagridview C#中的单击事件在PictureBox中显示图片