Skip to content

Commit cd3a987

Browse files
committed
Updating payload for paragraphs
1 parent 3ff5814 commit cd3a987

4 files changed

Lines changed: 85 additions & 0 deletions

File tree

Deepgram/Transcription/Alternative.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@ public class Alternative
2222
/// </summary>
2323
[JsonProperty("words")]
2424
public Words[] Words { get; set; }
25+
26+
/// <summary>
27+
/// Array of Paragraph objects.
28+
/// </summary>
29+
/// <remark>Only used when the paragraph feature is enabled on the request</remark>
30+
[JsonProperty("paragraphs")]
31+
public ParagraphGroup[] Paragraphs { get; set; }
2532
}
2633
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Deepgram.Transcription
5+
{
6+
public class Paragraph
7+
{
8+
/// <summary>
9+
/// Array of Sentence objects.
10+
/// </summary>
11+
[JsonProperty("sentences")]
12+
public Sentence[] Sentences { get; set; }
13+
14+
/// <summary>
15+
/// Offset in seconds from the start of the audio to where the paragraph starts.
16+
/// </summary>
17+
[JsonProperty("start")]
18+
public decimal Start { get; set; }
19+
20+
/// <summary>
21+
/// Offset in seconds from the start of the audio to where the paragraph ends.
22+
/// </summary>
23+
[JsonProperty("end")]
24+
public decimal End { get; set; }
25+
26+
/// <summary>
27+
/// Number of words in the paragraph
28+
/// </summary>
29+
[JsonProperty("num_words")]
30+
public int NumberOfWords { get; set; }
31+
}
32+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Deepgram.Transcription
5+
{
6+
public class ParagraphGroup
7+
{
8+
/// <summary>
9+
/// Full transcript
10+
/// </summary>
11+
[JsonProperty("transcript")]
12+
public string Transcript { get; set; } = string.Empty;
13+
14+
/// <summary>
15+
/// Array of Paragraph objects.
16+
/// </summary>
17+
[JsonProperty("paragraphs")]
18+
public Paragraph[] Paragraphs { get; set; }
19+
}
20+
}

Deepgram/Transcription/Sentence.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using Newtonsoft.Json;
3+
4+
namespace Deepgram.Transcription
5+
{
6+
public class Sentence
7+
{
8+
/// <summary>
9+
/// Text transcript of the sentence.
10+
/// </summary>
11+
[JsonProperty("text")]
12+
public string Text { get; set; } = string.Empty;
13+
14+
/// <summary>
15+
/// Offset in seconds from the start of the audio to where the sentence starts.
16+
/// </summary>
17+
[JsonProperty("start")]
18+
public decimal Start { get; set; }
19+
20+
/// <summary>
21+
/// Offset in seconds from the start of the audio to where the sentence ends.
22+
/// </summary>
23+
[JsonProperty("end")]
24+
public decimal End { get; set; }
25+
}
26+
}

0 commit comments

Comments
 (0)