(r *proto.TranscriptResult)
| 174 | } |
| 175 | |
| 176 | func transcriptResultFromProto(r *proto.TranscriptResult) *schema.TranscriptionResult { |
| 177 | if r == nil { |
| 178 | return &schema.TranscriptionResult{} |
| 179 | } |
| 180 | tr := &schema.TranscriptionResult{ |
| 181 | Text: r.Text, |
| 182 | Language: r.Language, |
| 183 | Duration: float64(r.Duration), |
| 184 | Eou: r.Eou, |
| 185 | } |
| 186 | |
| 187 | for _, s := range r.Segments { |
| 188 | var tks []int |
| 189 | for _, t := range s.Tokens { |
| 190 | tks = append(tks, int(t)) |
| 191 | } |
| 192 | var words []schema.TranscriptionWord |
| 193 | for _, w := range s.Words { |
| 194 | var word = schema.TranscriptionWord{ |
| 195 | Start: time.Duration(w.Start), |
| 196 | End: time.Duration(w.End), |
| 197 | Text: w.Text, |
| 198 | } |
| 199 | words = append(words, word) |
| 200 | tr.Words = append(tr.Words, word) |
| 201 | } |
| 202 | tr.Segments = append(tr.Segments, |
| 203 | schema.TranscriptionSegment{ |
| 204 | Text: s.Text, |
| 205 | Id: int(s.Id), |
| 206 | Start: time.Duration(s.Start), |
| 207 | End: time.Duration(s.End), |
| 208 | Tokens: tks, |
| 209 | Speaker: s.Speaker, |
| 210 | Words: words, |
| 211 | }) |
| 212 | } |
| 213 | return tr |
| 214 | } |
no outgoing calls
no test coverage detected