@@ -107,29 +107,23 @@ private async Task StoreCombinedRecognizedPhrasesAsync(Guid transcriptionId, int
107
107
108
108
var combinedPhrases = speechTranscript . CombinedRecognizedPhrases . Where ( t => t . Channel == channel ) . FirstOrDefault ( ) ;
109
109
110
- var query = "INSERT INTO dbo.CombinedRecognizedPhrases (ID, TranscriptionID, Channel, Lexical, Itn, MaskedItn, Display)" +
111
- " VALUES (@id, @transcriptionID, @channel, @lexical, @itn, @maskedItn, @display)" ;
110
+ var query = "INSERT INTO dbo.CombinedRecognizedPhrases (ID, TranscriptionID, Channel, Lexical, Itn, MaskedItn, Display, SentimentPositive, SentimentNeutral, SentimentNegative )" +
111
+ " VALUES (@id, @transcriptionID, @channel, @lexical, @itn, @maskedItn, @display, @sentimentPositive, @sentimentNeutral, @sentimentNegative )" ;
112
112
113
113
using ( var command = new SqlCommand ( query , Connection ) )
114
114
{
115
115
command . Parameters . AddWithValue ( "@id" , combinedRecognizedPhraseID ) ;
116
116
command . Parameters . AddWithValue ( "@transcriptionID" , transcriptionId ) ;
117
117
command . Parameters . AddWithValue ( "@channel" , channel ) ;
118
118
119
- if ( combinedPhrases != null )
120
- {
121
- command . Parameters . AddWithValue ( "@lexical" , combinedPhrases . Lexical ) ;
122
- command . Parameters . AddWithValue ( "@itn" , combinedPhrases . ITN ) ;
123
- command . Parameters . AddWithValue ( "@maskedItn" , combinedPhrases . MaskedITN ) ;
124
- command . Parameters . AddWithValue ( "@display" , combinedPhrases . Display ) ;
125
- }
126
- else
127
- {
128
- command . Parameters . AddWithValue ( "@lexical" , string . Empty ) ;
129
- command . Parameters . AddWithValue ( "@itn" , string . Empty ) ;
130
- command . Parameters . AddWithValue ( "@maskedItn" , string . Empty ) ;
131
- command . Parameters . AddWithValue ( "@display" , string . Empty ) ;
132
- }
119
+ command . Parameters . AddWithValue ( "@lexical" , combinedPhrases . Lexical ?? string . Empty ) ;
120
+ command . Parameters . AddWithValue ( "@itn" , combinedPhrases . ITN ?? string . Empty ) ;
121
+ command . Parameters . AddWithValue ( "@maskedItn" , combinedPhrases . MaskedITN ?? string . Empty ) ;
122
+ command . Parameters . AddWithValue ( "@display" , combinedPhrases . Display ?? string . Empty ) ;
123
+
124
+ command . Parameters . AddWithValue ( "@sentimentPositive" , combinedPhrases ? . Sentiment ? . Positive ?? 0f ) ;
125
+ command . Parameters . AddWithValue ( "@sentimentNeutral" , combinedPhrases ? . Sentiment ? . Neutral ?? 0f ) ;
126
+ command . Parameters . AddWithValue ( "@sentimentNegative" , combinedPhrases ? . Sentiment ? . Negative ?? 0f ) ;
133
127
134
128
var result = await command . ExecuteNonQueryAsync ( ) . ConfigureAwait ( false ) ;
135
129
@@ -194,18 +188,10 @@ private async Task StoreNBestAsync(Guid recognizedPhraseID, NBest nBest)
194
188
command . Parameters . AddWithValue ( "@itn" , nBest . ITN ) ;
195
189
command . Parameters . AddWithValue ( "@maskedItn" , nBest . MaskedITN ) ;
196
190
command . Parameters . AddWithValue ( "@display" , nBest . Display ) ;
197
- if ( nBest . Sentiment != null )
198
- {
199
- command . Parameters . AddWithValue ( "@sentimentNegative" , nBest . Sentiment . Negative ) ;
200
- command . Parameters . AddWithValue ( "@sentimentNeutral" , nBest . Sentiment . Neutral ) ;
201
- command . Parameters . AddWithValue ( "@sentimentPositive" , nBest . Sentiment . Positive ) ;
202
- }
203
- else
204
- {
205
- command . Parameters . AddWithValue ( "@sentimentNegative" , 0f ) ;
206
- command . Parameters . AddWithValue ( "@sentimentNeutral" , 0f ) ;
207
- command . Parameters . AddWithValue ( "@sentimentPositive" , 0f ) ;
208
- }
191
+
192
+ command . Parameters . AddWithValue ( "@sentimentNegative" , nBest ? . Sentiment ? . Negative ?? 0f ) ;
193
+ command . Parameters . AddWithValue ( "@sentimentNeutral" , nBest ? . Sentiment ? . Neutral ?? 0f ) ;
194
+ command . Parameters . AddWithValue ( "@sentimentPositive" , nBest ? . Sentiment ? . Positive ?? 0f ) ;
209
195
210
196
var result = await command . ExecuteNonQueryAsync ( ) . ConfigureAwait ( false ) ;
211
197
0 commit comments