Skip to content

Commit

Permalink
Fix warnings and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
HennerM committed Sep 7, 2023
1 parent 7b987a0 commit 76eedc1
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 5 deletions.
10 changes: 10 additions & 0 deletions SmRtAPI/SmRtAPI/Config/PunctuationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@

namespace Speechmatics.Realtime.Client.Config
{

/// <summary>
/// Configuration for customizing punctuation
/// </summary>
public class PunctuationConfig
{
/// <summary>
/// List of permitted punctuation marks
/// </summary>
public IEnumerable<string>? PermittedMarks { get; set; }

Check warning on line 16 in SmRtAPI/SmRtAPI/Config/PunctuationConfig.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

/// <summary>
/// Punctuation detection sensitivity, higher values will produce more punctuation, the default is 0.5
/// </summary>
public double? Sensitivity { get; set; }
}
}
15 changes: 15 additions & 0 deletions SmRtAPI/SmRtAPI/Config/SmRtApiConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Speechmatics.Realtime.Client.Config
{
/// <summary>
/// Configuration for an RT API session
/// </summary>
public class SmRtApiConfig : SmRtApiConfigBase
{
/// <summary>
Expand All @@ -26,10 +29,22 @@ public class SmRtApiConfig : SmRtApiConfigBase
/// </summary>
public Action<AddTranslationMessage> AddTranslationMessageCallback { get; set; }

/// <summary>
/// Create new config for a given language,
/// specifying input audio details
/// </summary>
/// <param name="model"></param>
/// <param name="sampleRate"></param>
/// <param name="audioFormatType"></param>
/// <param name="audioFormatEncoding"></param>
public SmRtApiConfig(string model, int sampleRate, AudioFormatType audioFormatType, AudioFormatEncoding audioFormatEncoding) : base(model, sampleRate, audioFormatType, audioFormatEncoding)
{
}

/// <summary>
/// Create transcription config for the specified language
/// </summary>
/// <param name="model"></param>
public SmRtApiConfig(string model) : base(model)
{
}
Expand Down
3 changes: 3 additions & 0 deletions SmRtAPI/SmRtAPI/Config/SpeakerDiarizationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Speechmatics.Realtime.Client.Config
{
/// <summary>
/// Additional configuration for diarization
/// </summary>
public class SpeakerDiarizationConfig
{
/// <summary>
Expand Down
11 changes: 11 additions & 0 deletions SmRtAPI/SmRtAPI/Config/TranslationConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@
namespace Speechmatics.Realtime.Client.Config
{

/// <summary>
/// Additional configuration for translation
/// </summary>
public class TranslationConfig {

/// <summary>
/// List of target languages to translate to
/// </summary>
public IEnumerable<string> TargetLanguages { get; set; }

/// <summary>
/// Flag for enabling translation partials.
/// These are based on transcription partials and thus subject to change.
/// </summary>
public bool EnablePartials { get; set; } = false;

}
Expand Down
9 changes: 9 additions & 0 deletions SmRtAPI/SmRtAPI/Enumerations/DiarizationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

namespace Speechmatics.Realtime.Client.Enumerations
{
/// <summary>
/// Specifying the type of diarization for this session
/// </summary>
public enum DiarizationType
{
/// <summary>
/// No diarization
/// </summary>
None,
/// <summary>
/// Speaker diarization
/// </summary>
Speaker,
}
}
4 changes: 2 additions & 2 deletions SmRtAPI/SmRtAPI/MessageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
using System.Threading.Tasks;
using Speechmatics.Realtime.Client.Messages;
using Speechmatics.Realtime.Client.Interfaces;
using Speechmatics.Realtime.Client.Messages;

namespace Speechmatics.Realtime.Client
{
internal class MessageWriter
{
private readonly ClientWebSocket _wsClient;
private readonly AutoResetEvent _transcriptionComplete;
private int _sequenceNumber;
private int _sequenceNumber = 0;
private readonly Stream _stream;
private readonly AutoResetEvent _recognitionStarted;
private readonly ISmRtApi _api;
Expand Down Expand Up @@ -51,6 +50,7 @@ public async Task Start()
while ((bytesRead = await _stream.ReadAsync(streamBuffer, 0, streamBuffer.Length)) > 0 && !_transcriptionComplete.WaitOne(0))
{
await SendData(new ArraySegment<byte>(streamBuffer, 0, bytesRead));
_sequenceNumber++;
}

var endOfStream = new EndOfStreamMessage(_sequenceNumber);
Expand Down
2 changes: 1 addition & 1 deletion SmRtAPI/SmRtAPI/Messages/AddPartialTranslationMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Speechmatics.Realtime.Client.Messages

/// <summary>
/// A partial translation is a translation that can be changed and expanded by a future AddTranslation or AddPartialTranslation message
// and corresponds to the part of audio since the last AddTranslation message.
/// and corresponds to the part of audio since the last AddTranslation message.
/// </summary>
public class AddPartialTranslationMessage : BaseMessage
{
Expand Down
4 changes: 3 additions & 1 deletion SmRtAPI/SmRtAPI/Messages/AddTranslationMessage.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace Speechmatics.Realtime.Client.Messages
{

/// <summary>
/// Translation final message
/// </summary>
public class TranslationSubMessage: BaseMessage
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions SmRtAPI/SmRtAPI/SmRtApiConfigBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public class SmRtApiConfigBase
/// </summary>
public string? Domain { get; set; }

Check warning on line 147 in SmRtAPI/SmRtAPI/SmRtApiConfigBase.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

/// <summary>
/// Optional configuration for Translation
/// </summary>
public TranslationConfig? TranslationConfig { get; set; }

Check warning on line 152 in SmRtAPI/SmRtAPI/SmRtApiConfigBase.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion SmRtAPI/Speechmatics.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Speechmatics</id>
<version>1.1.0</version>
<version>1.1.1</version>
<authors>Speechmatics</authors>
<owners>Speechmatics</owners>
<readme>docs/README.md</readme>
Expand Down

0 comments on commit 76eedc1

Please sign in to comment.