Skip to content

Commit

Permalink
Implement Multi-Lingual and Missing Speaker/Num_Words
Browse files Browse the repository at this point in the history
  • Loading branch information
dvonthenen committed Jul 9, 2024
1 parent e625bf9 commit 9f8d659
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Deepgram/Models/Live/v1/Alternative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public record Alternative
[JsonPropertyName("words")]
public IReadOnlyList<Word>? Words { get; set; }

/// <summary>
/// ReadOnlyList of Languages Detected
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("languages")]
public IReadOnlyList<string>? Languages { get; set; }

/// <summary>
/// Override ToString method to serialize the object
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Deepgram/Models/Live/v1/Word.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public record Word
[JsonPropertyName("punctuated_word")]
public string? PunctuatedWord { get; set; }

/// <summary>
/// Language detected
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("language")]
public string? Language { get; set; }

/// <summary>
/// Speaker index of who said this word
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Deepgram/Models/PreRecorded/v1/Alternative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public record Alternative
[JsonPropertyName("entities")]
public IReadOnlyList<Entity>? Entities { get; set; }

/// <summary>
/// ReadOnlyList of Languages Detected
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("languages")]
public IReadOnlyList<string>? Languages { get; set; }

/// <summary>
/// ReadOnly List of <see cref="ParagraphGroup"/> containing separated transcript and <see cref="Paragraph"/> objects.
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion Deepgram/Models/PreRecorded/v1/Paragraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public record Paragraph
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("num_words")]
internal int? NumWords { get; set; }
public int? NumWords { get; set; }

/// <summary>
/// Offset in seconds from the start of the audio to where the paragraph starts.
Expand All @@ -27,6 +27,13 @@ public record Paragraph
[JsonPropertyName("start")]
public decimal? Start { get; set; }

/// <summary>
/// speak Index
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("speaker")]
public int? Speaker { get; set; }

/// <summary>
/// Offset in seconds from the start of the audio to where the paragraph ends.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions Deepgram/Models/PreRecorded/v1/Word.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public record Word
[JsonPropertyName("end")]
public decimal? End { get; set; }

/// <summary>
/// Language detected
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("language")]
public string? Language { get; set; }

/// <summary>
/// Punctuated version of the word
/// </summary>
Expand Down

0 comments on commit 9f8d659

Please sign in to comment.