OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/speech/google_streaming_remote_engine.h" | 5 #include "content/browser/speech/google_streaming_remote_engine.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 const proto::SpeechRecognitionAlternative& ws_alternative = | 448 const proto::SpeechRecognitionAlternative& ws_alternative = |
449 ws_result.alternative(j); | 449 ws_result.alternative(j); |
450 SpeechRecognitionHypothesis hypothesis; | 450 SpeechRecognitionHypothesis hypothesis; |
451 if (ws_alternative.has_confidence()) | 451 if (ws_alternative.has_confidence()) |
452 hypothesis.confidence = ws_alternative.confidence(); | 452 hypothesis.confidence = ws_alternative.confidence(); |
453 else if (ws_result.has_stability()) | 453 else if (ws_result.has_stability()) |
454 hypothesis.confidence = ws_result.stability(); | 454 hypothesis.confidence = ws_result.stability(); |
455 DCHECK(ws_alternative.has_transcript()); | 455 DCHECK(ws_alternative.has_transcript()); |
456 // TODO(hans): Perhaps the transcript should be required in the proto? | 456 // TODO(hans): Perhaps the transcript should be required in the proto? |
457 if (ws_alternative.has_transcript()) | 457 if (ws_alternative.has_transcript()) |
458 hypothesis.utterance = UTF8ToUTF16(ws_alternative.transcript()); | 458 hypothesis.utterance = base::UTF8ToUTF16(ws_alternative.transcript()); |
459 | 459 |
460 result.hypotheses.push_back(hypothesis); | 460 result.hypotheses.push_back(hypothesis); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 delegate()->OnSpeechRecognitionEngineResults(results); | 464 delegate()->OnSpeechRecognitionEngineResults(results); |
465 | 465 |
466 return state_; | 466 return state_; |
467 } | 467 } |
468 | 468 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 586 } |
587 | 587 |
588 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 588 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
589 : event(event_value) { | 589 : event(event_value) { |
590 } | 590 } |
591 | 591 |
592 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { | 592 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { |
593 } | 593 } |
594 | 594 |
595 } // namespace content | 595 } // namespace content |
OLD | NEW |