我如何...将c#代码转换为python [英] How do i...convert c# code to python

查看:322
本文介绍了我如何...将c#代码转换为python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程的新手,所以我向所有人道歉。

我的问题是问题是下面用c#编写的代码可以转换为python吗?



recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@txt file location)))));



我尝试了什么:



我试过这个



self。 __recognizer.LoadGrammar(Grammar(GrammarBuilder(Choices(File.ReadAllLines(txt file location)))))

I'm new to programming so My apologies to all.
My question is Question is can the code below written in c# be converted to python?

recognizer.LoadGrammar(new Grammar(new GrammarBuilder(new Choices(File.ReadAllLines(@"txt file location")))));

What I have tried:

I tried this

self.__recognizer.LoadGrammar(Grammar(GrammarBuilder(Choices(File.ReadAllLines("txt file location")))))

推荐答案

这不能简单地转换为Python因为它使用C# GrammarBuilder类(Microsoft.Speech.Recognition) [ ^ ] 。



所以你必须看看是否有一些Python库使用语音识别语法规范版本1.0 [ ^ ]。



但这需要了解C#代码正在做什么以及如何用Python实现类似的操作。
This can't be simply converted to Python because it uses the C# GrammarBuilder Class (Microsoft.Speech.Recognition)[^].

So you have to look if there is some Python library providing similar functionality using the Speech Recognition Grammar Specification Version 1.0[^].

But this requires to understand what the C# code is doing and how similar operations can be implemented with Python.


这篇关于我如何...将c#代码转换为python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆