Merge pull request #2893 from lissyx/example-api-net

Example api net
This commit is contained in:
lissyx 2020-04-08 12:47:40 +02:00 committed by GitHub
commit 83675f5ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 9 deletions

View File

@ -16,9 +16,9 @@ DeepSpeech Class
:members:
DeepSpeechStream Class
----------------
----------------------
.. doxygenclass:: DeepSpeechClient::DeepSpeechStream
.. doxygenclass:: DeepSpeechClient::Models::DeepSpeechStream
:project: deepspeech-dotnet
:members:

29
doc/DotNet-Examples.rst Normal file
View File

@ -0,0 +1,29 @@
.Net API Usage example
======================
Examples are from `native_client/dotnet/DeepSpeechConsole/Program.cs`.
Creating a model instance and loading model
-------------------------------------------
.. literalinclude:: ../native_client/dotnet/DeepSpeechConsole/Program.cs
:language: csharp
:linenos:
:lineno-match:
:start-after: sphinx-doc: csharp_ref_model_start
:end-before: sphinx-doc: csharp_ref_model_stop
Performing inference
--------------------
.. literalinclude:: ../native_client/dotnet/DeepSpeechConsole/Program.cs
:language: csharp
:linenos:
:lineno-match:
:start-after: sphinx-doc: csharp_ref_inference_start
:end-before: sphinx-doc: csharp_ref_inference_stop
Full source code
----------------
See :download:`Full source code<../native_client/dotnet/DeepSpeechConsole/Program.cs>`.

View File

@ -104,7 +104,7 @@ language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['.build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ['.build', 'Thumbs.db', '.DS_Store', 'node_modules']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

View File

@ -54,17 +54,19 @@ Welcome to DeepSpeech's documentation!
C-Examples
NodeJS-Examples
DotNet-Examples
Java-Examples
NodeJS-Examples
Python-Examples
.. toctree::
:maxdepth: 2
:caption: Contributed examples
DotNet-contrib-examples.rst
DotNet-contrib-examples
NodeJS-contrib-Examples

View File

@ -51,8 +51,10 @@ namespace CSharpExamples
{
Console.WriteLine("Loading model...");
stopwatch.Start();
// sphinx-doc: csharp_ref_model_start
using (IDeepSpeech sttClient = new DeepSpeech(model ?? "output_graph.pbmm"))
{
// sphinx-doc: csharp_ref_model_stop
stopwatch.Stop();
Console.WriteLine($"Model loaded - {stopwatch.Elapsed.Milliseconds} ms");
@ -72,6 +74,7 @@ namespace CSharpExamples
stopwatch.Start();
string speechResult;
// sphinx-doc: csharp_ref_inference_start
if (extended)
{
Metadata metaResult = sttClient.SpeechToTextWithMetadata(waveBuffer.ShortBuffer,
@ -83,6 +86,7 @@ namespace CSharpExamples
speechResult = sttClient.SpeechToText(waveBuffer.ShortBuffer,
Convert.ToUInt32(waveBuffer.MaxSize / 2));
}
// sphinx-doc: csharp_ref_inference_stop
stopwatch.Stop();

View File

@ -1,6 +1,6 @@
breathe==4.13.1
breathe==4.14.2
semver==2.8.1
sphinx==2.2.0
sphinx==2.4.4
sphinx-js==2.8
sphinx-rtd-theme==0.4.3
pygments==2.4.2
pygments==2.6.1