From 70c4f18e50094b39cda585629f27257e55327f0e Mon Sep 17 00:00:00 2001 From: bcutler94 Date: Thu, 1 Jun 2023 11:09:16 -0400 Subject: [PATCH 1/2] Add Entities and Topics in PreRecorded response --- deepgram/prerecorded.go | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/deepgram/prerecorded.go b/deepgram/prerecorded.go index 16c16081..03a41da4 100644 --- a/deepgram/prerecorded.go +++ b/deepgram/prerecorded.go @@ -89,9 +89,31 @@ type WordBase struct { } type Alternative struct { - Transcript string `json:"transcript"` - Confidence float64 `json:"confidence"` - Words []WordBase `json:"words"` + Transcript string `json:"transcript"` + Confidence float64 `json:"confidence"` + Words []WordBase `json:"words"` + Topics []TopicBase `json:"topics"` + Entities []EntityBase `json:"entities"` +} + +type EntityBase struct { + Label string `json:"label"` + Value string `json:"value"` + Confidence float64 `json:"confidence"` + StartWord int `json:"start_word"` + EndWord int `json:"end_word"` +} + +type TopicBase struct { + Text string `json:"text"` + StartWord int `json:"start_word"` + EndWord int `json:"end_word"` + Topics []Topic `json:"topics"` +} + +type Topic struct { + Topic string `json:"topic"` + Confidence int `json:"confidence"` } type Channel struct { From 7dcbe0a48fb94b29b5cebf4761b14600402735b6 Mon Sep 17 00:00:00 2001 From: bcutler94 Date: Thu, 1 Jun 2023 12:19:58 -0400 Subject: [PATCH 2/2] whooops --- deepgram/prerecorded.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deepgram/prerecorded.go b/deepgram/prerecorded.go index 03a41da4..8b7a3013 100644 --- a/deepgram/prerecorded.go +++ b/deepgram/prerecorded.go @@ -112,8 +112,8 @@ type TopicBase struct { } type Topic struct { - Topic string `json:"topic"` - Confidence int `json:"confidence"` + Topic string `json:"topic"` + Confidence float64 `json:"confidence"` } type Channel struct {