这个软件包是把口语翻译成书面语言
spoken2written的Python项目详细描述
#英语口语和书面英语翻译
我们的写作和说话是有区别的。e、 g说话的时候我们说“我付了两万美元给xyz组织”。但是,我们并没有将上面的例子写成“我向xyz组织支付了20000美元” 这是一个python模块,用来将这种英语口语翻译成书面形式。在
- 例如,它将翻译为:“我看过名为triple H的电影。”到“我看过名为HHH的电影” 我的体重是55公斤 “我向xyz组织支付了两万美元。”到“我向xyz组织支付了20000美元。”
<;h1>;安装指南<;/h1>
在终端中运行此命令: ` pip install spoken2written ` 安装包后,还将安装依赖项spaCy,word2number。 最好是有英语语言依赖性要求的空间,这是英语的核心
要安装这个en_core_web_sm,请在终端中运行以下命令 ` python -m spacy download en_core_web_sm ` <;h1>;用法<;/h1>
首先,您必须使用以下代码导入模块。 ` import spoken2written ` 如果在导入过程中显示错误,则您的设备中未安装spacy english dependency包。在这种情况下, 使用上述命令安装en_core_web_sm library。在
导入包后,使用TextTraslator方法将英语口语翻译成书面形式。在
示例脚本: ` >>>from spoken2written import TextTranslator ...test= "My life is triple B . European authorities fined Google a record sixty five thousand dollars on Wednesday for abusing its power in the mobile phone market and ordered the company to alter its practices . Furthermore , My T - Shirt size is double X in 2019 and it costs six dollars . My weight is fifty kilograms ." ...result=TextTranslator(test)...print(result) ` 输出: ` My life is BBB . European authorities fined Google a record $65000 on Wednesday for abusing its power in the mobile phone market and ordered the company to alter its practices . Furthermore , My T - Shirt size is XX in 2019 and it costs $6 . My weight is 50 kg . `
<;h1>;用于开发此软件包的功能<;/h1>
- 名称实体识别技术用于从给定输入中检测实体。名称实体识别是使用名为“spaCy”的库完成的。使用该技术可以检测到诸如数量(例如重量:50公斤)、货币(例如金额:千美元)、专有名词等实体。在
- 包word2number用于将写为“两千”的数字转换为“2000”。此外,根据实体的类型,很少几行逻辑代码会添加后缀/前缀$/kg等。在
- 在某些文本中,可能会出现“双X”等实体。在这种情况下,double这个词充当形容词,然后X作为名词。为了检测这类文本及其相应的词性,使用空间标记匹配器。同样,在检测到实体之后,几行逻辑代码将把“double X”转换为“XX”。在
<;b>;此包中所有函数的逻辑代码都可以在spoken2writed/spoken2writed/spoken2文件中找到已写入.py此存储库的<;/b>
<;h1>;错误/错误<;/h1>; 在导入包writen2Spoken之前,请确保已安装dependency en_core_web_sm of spacy。如果在使用上述代码时发现任何错误,请通过<;a href=“https://github.com/HerambVD/spoken2written”>;GitHub<;/a>;提出问题;。否则,请发送电子邮件至<;a href=“mailto:heramb1711@gmail.com”>;heramb1711@gmail.com<;/a>;。在
- 项目
标签: