1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
|
<!DOCTYPE html PUBLIC "html">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="tizen.css" media="screen">
<script type="text/javascript" src="snippet.js"></script>
<title>Speech API</title>
</head>
<body id="content" onload="prettyPrint()">
<div class="api" id="::Speech">
<div class="title">
<h1>Speech API</h1>
</div>
<div class="description">
<p>The Web Speech API aims to enable web developers to provide, in a web browser, speech-input and text-to-speech output
features that are typically not available when using standard speech-recognition or screen-reader software.</p>
</div>
<h2>Table of Contents</h2>
<ul class="toc">
<li>1. <a href="#typedefs">Type Definitions</a>
<ul class="toc">
<li>1.1. <a href="#::ErrorCode">ErrorCode</a>
</li>
</ul>
</li>
<li>2. <a href="#interfaces">Interfaces</a>
<ul class="toc">
<li>2.1. <a href="#::SpeechManagerObject">SpeechManagerObject</a>
</li>
<li>2.2. <a href="#::SpeechManager">SpeechManager</a>
</li>
<li>2.3. <a href="#::SpeechRecognition">SpeechRecognition</a>
</li>
<li>2.4. <a href="#::SpeechRecognitionError">SpeechRecognitionError</a>
</li>
<li>2.5. <a href="#::SpeechRecognitionAlternative">SpeechRecognitionAlternative</a>
</li>
<li>2.6. <a href="#::SpeechRecognitionResult">SpeechRecognitionResult</a>
</li>
<li>2.7. <a href="#::SpeechRecognitionResultList">SpeechRecognitionResultList</a>
</li>
<li>2.8. <a href="#::SpeechRecognitionEvent">SpeechRecognitionEvent</a>
</li>
<li>2.9. <a href="#::SpeechGrammar">SpeechGrammar</a>
</li>
<li>2.10. <a href="#::SpeechGrammarList">SpeechGrammarList</a>
</li>
</ul>
</li>
<li>3. <a href="#full-webidl">Full WebIDL</a>
</li>
</ul>
<hr>
<h2 id="method-summary">Summary of Interfaces and Methods</h2>
<table class="informaltable">
<thead>
<tr>
<th>Interface</th>
<th>Method</th>
</tr>
<tr>
<td><a href="#::SpeechManagerObject"> SpeechManagerObject</a></td>
<td></td>
</tr>
<tr>
<td><a href="#::SpeechManager"> SpeechManager</a></td>
<td>void <a href="#::SpeechManager::vocalizeString">
vocalizeString</a>(DOMString speakString);</td>
</tr>
<tr>
<td><a href="#::SpeechRecognition"> SpeechRecognition</a></td>
<td>void <a href="#::SpeechRecognition::start">start</a>(); <br>
void <a href="#::SpeechRecognition::stop">stop</a>(); <br> void <a
href="#::SpeechRecognition::abort">abort()</a>; <br></td>
</tr>
<tr>
<td><a href="#::SpeechRecognitionError">
SpeechRecognitionError</a></td>
<td></td>
</tr>
<tr>
<td><a href="#::SpeechRecognitionAlternative">
SpeechRecognitionAlternative</a></td>
<td></td>
</tr>
<tr>
<td><a href="#::SpeechRecognitionResult">
SpeechRecognitionResult</a></td>
<td><a href="#::SpeechRecognitionAlternative"><span class="typ">SpeechRecognitionAlternative</span></a>
<a href="#::SpeechRecognitionResult::item">item</a>(unsigned long index); <br></td>
</tr>
<tr>
<td><a href="#::SpeechRecognitionResultList">
SpeechRecognitionResultList</a></td>
<td><a href="#::SpeechRecognitionResult"><span class="typ">SpeechRecognitionResult</span></a>
<a href="#::SpeechRecognitionResultList::item">item</a>(unsigned long index); <br></td>
</tr>
<tr>
<td><a href="#::SpeechRecognitionEvent">
SpeechRecognitionEvent</a></td>
<td></td>
</tr>
<tr>
<td><a href="#::SpeechGrammar"> SpeechGrammar</a></td>
<td></td>
</tr>
<tr>
<td><a href="#::SpeechGrammarList"> SpeechGrammarList</a></td>
<td><a href="#::SpeechGrammar"><span class="typ">SpeechGrammar</span></a>
<a href="#::SpeechGrammarList::item">item</a>(unsigned long index); <br> void <a
href="#::SpeechGrammarList::addFromURI">
addFromURI</a>(DOMString src, optional float weight); <br> void <a
href="#::SpeechGrammarList::addFromString">
addFromString</a>(DOMString string, optional float weight); <br></td>
</tr>
</thead>
<tbody></tbody>
</table>
<!-- -------------------------------- -->
<div class="typedefs" id="typedefs">
<h2>1. Type Definitions</h2>
<div class="enum" id="::ErrorCode">
<h3>1.1. ErrorCode</h3>
<div class="brief">Error codes for <a href="#::SpeechRecognitionError"><span class="typ">SpeechRecognitionError</span></a>.</div>
<pre class="webidl prettyprint">
enum ErrorCode {"no-speech", "aborted", "audio-capture", "network", "not-allowed", "service-not-allowed", "bad-grammar", "language-not-supported"};
</pre>
</div>
</div>
<!-- -------------------------------- -->
<div class="interfaces" id="interfaces">
<h2>2. Interfaces</h2>
<div class="interface" id="::SpeechManagerObject">
<h3>2.1. SpeechManagerObject</h3>
<div class="brief">This interface defines what is instantiated
by the Tizen object by the Tizen Platform. There will be a
tizen.speech object that allows access to the functionality of the
SpeechManager API.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechManagerObject {
readonly attribute <a href="#::SpeechManager"><span class="typ">SpeechManager</span></a> speech;
};
</pre>
<pre class="webidl prettyprint">
Tizen implements SpeechManagerObject;
</pre>
</div>
<div class="interface" id="::SpeechManager">
<h3>2.2. SpeechManager</h3>
<div class="brief">This section defines the speech manager interface.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechManager {
void vocalizeString(DOMString speakString);
};
</pre>
<div class="methods">
<h4>Methods</h4>
<dl>
<dt class="method" id="::SpeechManager::vocalizeString">
<span class="methodName">vocalizeString</span>
</dt>
<dd>
<div class="brief">Achieves text-to-speech feature.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void vocalizeString(DOMString speakString);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">speakString</span>: A text.</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
<div class="interface" id="::SpeechRecognition">
<h3>2.3. SpeechRecognition</h3>
<div class="brief"></div>
<pre class="webidl prettyprint">
[Constructor()]
interface SpeechRecognition : EventTarget {
attribute <a href="#::SpeechGrammarList"><span class="typ">SpeechGrammarList</span></a> grammars;
attribute DOMString lang;
attribute boolean continuous;
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute DOMString serviceURI;
void start();
void stop();
void abort();
attribute EventHandler onaudiostart;
attribute EventHandler onsoundstart;
attribute EventHandler onspeechstart;
attribute EventHandler onspeechend;
attribute EventHandler onsoundend;
attribute EventHandler onaudioend;
attribute EventHandler onresult;
attribute EventHandler onnomatch;
attribute EventHandler onerror;
attribute EventHandler onstart;
attribute EventHandler onend;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechRecognition::grammars"><span
class="attrName"><span class="type">SpeechGrammarList
</span><span class="name">grammars</span></span>
<div class="brief">An attribute to stores the collection of
SpeechGrammar objects which represent the grammars that are
active for this recognition.</div></li>
<li class="attribute" id="::SpeechRecognition::lang"><span
class="attrName"><span class="type">DOMString </span><span
class="name">lang</span></span>
<div class="brief">An attribute to set the language of the
recognition for the request.</div></li>
<li class="attribute" id="::SpeechRecognition::continuous"><span
class="attrName"><span class="type">DOMString </span><span
class="name">continuous</span></span>
<div class="brief">The default value is false.</div></li>
<li class="attribute" id="::SpeechRecognition::interimResults"><span
class="attrName"><span class="type">boolean </span><span
class="name">interimResults</span></span>
<div class="brief">An attribute to control whether interim
results are returned. The default value is false.</div></li>
<li class="attribute" id="::SpeechRecognition::maxAlternatives"><span
class="attrName"><span class="type">unsigned long </span><span
class="name">maxAlternatives</span></span>
<div class="brief">An attribute to set the maximum number
of SpeechRecognitionAlternatives per result. The default value
is 1.</div></li>
<li class="attribute" id="::SpeechRecognition::serviceURI"><span
class="attrName"><span class="type">DOMString </span><span
class="name">serviceURI</span></span>
<div class="brief">An attribute to specifies the location
of the speech recognition service that the web application
wishes to use.</div></li>
<li class="attribute" id="::SpeechRecognition::onaudiostart"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onaudiostart</span></span>
<div class="brief">Fired when the user agent has started to capture audio.
</div></li>
<li class="attribute" id="::SpeechRecognition::onsoundstart"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onsoundstart</span></span>
<div class="brief">Fired when some sound, possibly speech, has been detected.
</div></li>
<li class="attribute" id="::SpeechRecognition::onspeechstart"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onspeechstart</span></span>
<div class="brief">Fired when the speech that will be used for speech recognition has started.
</div></li>
<li class="attribute" id="::SpeechRecognition::speechend"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">speechend</span></span>
<div class="brief">Fired when the speech that will be used for speech recognition has ended.
The speechstart event must always have been fire before speechend.
</div></li>
<li class="attribute" id="::SpeechRecognition::soundend"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">soundend</span></span>
<div class="brief">Fired when some sound is no longer detected.
The soundstart event must always have been fired before soundend.
</div></li>
<li class="attribute" id="::SpeechRecognition::audioend"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">audioend</span></span>
<div class="brief">Fired when the user agent has finished capturing audio.
The audiostart event must always have been fired before audioend.
</div></li>
<li class="attribute" id="::SpeechRecognition::onresult"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onresult</span></span>
<div class="brief">Fired when the speech recognizer returns a result.
</div></li>
<li class="attribute" id="::SpeechRecognition::onnomatch"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onnomatch</span></span>
<div class="brief">Fired when the speech recognizer returns a final result with no recognition
hypothesis that meet or exceed the confidence threshold.
</div></li>
<li class="attribute" id="::SpeechRecognition::onerror"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onerror</span></span>
<div class="brief">Fired when a speech recognition error occurs.
</div></li>
<li class="attribute" id="::SpeechRecognition::onstart"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onstart</span></span>
<div class="brief">Fired when the recognition service has begun to listen to the audio with the intention of recognizing.
</div></li>
<li class="attribute" id="::SpeechRecognition::onend"><span
class="attrName"><span class="type">EventHandler </span><span
class="name">onend</span></span>
<div class="brief">Fired when the service has disconnected.
</div></li>
</ul>
</div>
<div class="methods">
<h4>Methods</h4>
<dl>
<dt class="method" id="::SpeechRecognition::start">
<span class="methodName">start</span>
</dt>
<dd>
<div class="brief">When the start method is called it
represents the moment in time the web application wishes to
begin recognition. Once the system is successfully listening to
the recognition the user agent must raise a start event.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void start();
<span class="pln"></span>
</pre>
</div>
<div class="exceptionlist">
<p>
<span class="except">Exceptions:</span>
</p>
<ul class="exception">
<li>WebAPIException
<ul>
<li class="list"><p>with error type
InvalidStateError, if the start method is called on an
already started object.
</p></li>
</ul>
</li>
</ul>
</div>
</dd>
<dt class="method" id="::SpeechRecognition::stop">
<span class="methodName">stop</span>
</dt>
<dd>
<div class="brief">The stop method represents an
instruction to the recognition service to stop listening to more
audio, and to try and return a result using just the audio that
it has already received for this recognition.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void stop();
<span class="pln"></span>
</pre>
</div>
</dd>
<dt class="method" id="::SpeechRecognition::abort">
<span class="methodName">abort</span>
</dt>
<dd>
<div class="brief"> The abort method is a request to immediately
stop listening and stop recognizing and do not return any
information but that the system is done. When the abort method
is called, the speech service must stop recognizing. The user
agent must raise an end event once the speech service is no
longer connected.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void abort();
<span class="pln"></span>
</pre>
</div>
</dd>
</dl>
</div>
</div>
<div class="interface" id="::SpeechRecognitionError">
<h3>2.4. SpeechRecognitionError</h3>
<div class="brief">The SpeechRecognitionError event is the
interface used for the error event.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechRecognitionError : Event {
readonly attribute <a href="#::ErrorCode"><span class="typ">ErrorCode</span></a> error;
readonly attribute DOMString message;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechRecognitionError::error"><span
class="attrName"><span class="readonly">readonly </span><span class="type">ErrorCode </span><span
class="name">error</span></span>
<div class="brief">An attribute to get error code.</div></li>
<li class="attribute" id="::SpeechRecognitionError::message"><span
class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span
class="name">message</span></span>
<div class="brief">An attribute to get error message.</div></li>
</ul>
</div>
</div>
</div>
<div class="interface" id="::SpeechRecognitionAlternative">
<h3>2.5. SpeechRecognitionAlternative</h3>
<div class="brief">The SpeechRecognitionAlternative represents
a simple view of the response that gets used in a n-best list.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechRecognitionAlternative {
readonly attribute DOMString transcript;
readonly attribute float confidence;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute"
id="::SpeechRecognitionAlternative::transcript"><span
class="attrName"><span class="readonly">readonly </span><span class="type">DOMString </span><span
class="name">transcript</span></span>
<div class="brief">An attribute to get the raw words that
the user spoke.</div></li>
<li class="attribute"
id="::SpeechRecognitionAlternative::confidence"><span
class="attrName"><span class="readonly">readonly </span><span class="type">float </span><span
class="name">confidence</span></span>
<div class="brief">An attribute to get a numeric estimate
between 0 and 1 of how confident the recognition system is that
the recognition is correct. A higher number means the system is
more confident.</div></li>
</ul>
</div>
</div>
</div>
<div class="interface" id="::SpeechRecognitionResult">
<h3>2.6. SpeechRecognitionResult</h3>
<div class="brief">The SpeechRecognitionResult object represents
a single one-shot recognition match, either as one small part of a
continuous recognition or as the complete return result of a
non-continuous recognition.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechRecognitionResult {
readonly attribute unsigned long length;
<a href="#::SpeechRecognitionAlternative"><span class="typ">SpeechRecognitionAlternative</span></a> item(unsigned long index);
readonly attribute boolean final;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechRecognitionResult::length"><span
class="attrName"><span class="readonly">readonly </span><span class="type">unsigned long </span><span
class="name">length</span></span>
<div class="brief">An attribute to represent how many n-best
alternatives are represented in the item array.</div></li>
<li class="attribute" id="::SpeechRecognitionResult::final"><span
class="attrName"><span class="readonly">readonly </span><span class="type">boolean </span><span
class="name">final</span></span>
<div class="brief">An attribute to control whether or not an 3 characters.
interim result cannot be changed.</div></li>
</ul>
</div>
<div class="methods">
<h4>Methods</h4>
<dl>
<dt class="method" id="::SpeechRecognitionResult::item">
<span class="methodName">item</span>
</dt>
<dd>
<div class="brief">Returns a SpeechRecognitionAlternative
from the index into an array of n-best values. If index is greater
than or equal to length, returns null.</div>
<div class="synopsis">
<pre class="signature prettyprint">
SpeechRecognitionAlternative item(unsigned long index);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">index</span>: An index of the <a href="#::SpeechRecognitionAlternative"><span class="typ">SpeechRecognitionAlternative</span></a> array.</li>
</ul>
</div>
<div class="returntype">
<p>
<span class="return">Return value:</span>
</p>
A <a href="#::SpeechRecognitionAlternative"><span class="typ">SpeechRecognitionAlternative</span></a> object.
</div>
</dd>
</dl>
</div>
</div>
</div>
<div class="interface" id="::SpeechRecognitionResultList">
<h3>2.7. SpeechRecognitionResultList</h3>
<div class="brief">The SpeechRecognitionResult object represents
a single one-shot recognition match, either as one small part of a
continuous recognition or as the complete return result of a
non-continuous recognition.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechRecognitionResultList {
readonly attribute unsigned long length;
<a href="#::SpeechRecognitionResult"><span class="typ">SpeechRecognitionResult</span></a> item(unsigned long index);
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechRecognitionResultList::length"><span
class="attrName"><span class="readonly">readonly </span><span class="type">unsigned long </span><span
class="name">length</span></span>
<div class="brief">An attribute to indicate how many results
are represented in the item array.</div></li>
</ul>
</div>
<div class="methods">
<h4>Methods</h4>
<dl>
<dt class="method" id="::SpeechRecognitionResultList::item">
<span class="methodName">item</span>
</dt>
<dd>
<div class="brief">Returns a SpeechRecognitionResult from the
index into an array of result values. If index is greater than or
equal to length, returns null.</div>
<div class="synopsis">
<pre class="signature prettyprint">
SpeechRecognitionResult item(unsigned long index);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">index</span>: An index of the <a href="#::SpeechRecognitionResult"><span class="typ">SpeechRecognitionResult</span></a> array.</li>
</ul>
</div>
<div class="returntype">
<p>
<span class="return">Return value:</span>
</p>
A <a href="#::SpeechRecognitionResult"><span class="typ">SpeechRecognitionResult</span></a> object.
</div>
</dd>
</dl>
</div>
</div>
</div>
<div class="interface" id="::SpeechRecognitionEvent">
<h3>2.8. SpeechRecognitionEvent</h3>
<div class="brief">The SpeechRecognitionEvent is the event that
is raised each time there are any changes to interim or final
results.</div>
<pre class="webidl prettyprint">
[NoInterfaceObject] interface SpeechRecognitionEvent : Event {
readonly attribute unsigned long resultIndex;
readonly attribute <a href="#::SpeechRecognitionResultList"><span class="typ">SpeechRecognitionResultList</span></a> results;
readonly attribute any interpretation;
readonly attribute Document emma;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechRecognitionEvent::length"><span
class="attrName"><span class="readonly">readonly </span><span class="type">unsigned long </span><span
class="name">resultIndex</span></span>
<div class="brief">An attribute to get the lowest index in
the results array that has changed.</div></li>
<li class="attribute" id="::SpeechRecognitionEvent::results"><span
class="attrName"><span class="readonly">readonly </span><span class="type">SpeechRecognitionResultList
</span><span class="name">results</span></span>
<div class="brief">An attribute to get all current
recognition results for this session.</div></li>
<li class="attribute" id="::SpeechRecognitionEvent::interpretation"><span
class="attrName"><span class="readonly">readonly </span><span class="type">any </span><span
class="name">interpretation</span></span>
<div class="brief">An attribute to represent the semantic
meaning from what the user said.</div></li>
<li class="attribute" id="::SpeechRecognitionEvent::emma"><span
class="attrName"><span class="readonly">readonly </span><span class="type">Document </span><span
class="name">emma</span></span>
<div class="brief">An attribute to get emma.</div></li>
</ul>
</div>
</div>
</div>
<div class="interface" id="::SpeechGrammar">
<h3>2.9. SpeechGrammar</h3>
<div class="brief">The SpeechGrammar object represents a
container for a grammar.</div>
<pre class="webidl prettyprint">
[Constructor()]
interface SpeechGrammar {
attribute DOMString src;
attribute float weight;
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechGrammar::src"><span
class="attrName"><span class="type">DOMString </span><span
class="name">src</span></span>
<div class="brief">An attribute to get the URI for the
grammar.</div></li>
<li class="attribute" id="::SpeechGrammar::weight"><span
class="attrName"><span class="type">float </span><span
class="name">weight</span></span>
<div class="brief">An attribute to control the weight that
the speech recognition service should use with this grammar. By
default, a grammar has a weight of 1.</div></li>
</ul>
</div>
</div>
</div>
<div class="interface" id="::SpeechGrammarList">
<h3>2.10. SpeechGrammarList</h3>
<div class="brief">The SpeechGrammarList object represents a
collection of SpeechGrammar objects.</div>
<pre class="webidl prettyprint">
[Constructor()]
interface SpeechGrammarList {
readonly attribute unsigned long length;
<a href="#::SpeechGrammar"><span class="typ">SpeechGrammar</span></a> item(unsigned long index);
void addFromURI(DOMString src, optional float weight);
void addFromString(DOMString string, optional float weight);
};
</pre>
<div class="attributes">
<h4>Attributes</h4>
<ul>
<li class="attribute" id="::SpeechGrammarList::length"><span
class="attrName"><span class="readonly">readonly </span><span class="type">unsigned long </span><span
class="name">length</span></span>
<div class="brief">An attribute to represent how many
grammars are currently in the array.</div></li>
</ul>
</div>
<div class="methods">
<h4>Methods</h4>
<dl>
<dt class="method" id="::SpeechGrammarList::item">
<span class="methodName">item</span>
</dt>
<dd>
<div class="brief">Returns a SpeechGrammar from the index
into an array of grammars.</div>
<div class="synopsis">
<pre class="signature prettyprint">
SpeechGrammar item(unsigned long index);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">index</span>: An index of the <a href="#::SpeechGrammar"><span class="typ">SpeechGrammar</span></a> array.</li>
</ul>
</div>
<div class="returntype">
<p>
<span class="return">Return value:</span>
</p>
A <a href="#::SpeechGrammar"><span class="typ">SpeechGrammar</span></a> object.
</div>
</dd>
<dt class="method" id="::SpeechGrammarList::addFromURI">
<span class="methodName">addFromURI</span>
</dt>
<dd>
<div class="brief">Appends a grammar to the grammars array
parameter based on URI.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void addFromURI(DOMString src, optional float weight);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">src</span>: The URI for the grammar.</li>
<li class="param"><span class="name">weight[optional]</span>: The weight the grammar.</li>
</ul>
</div>
</dd>
<dt class="method" id="::SpeechGrammarList::addFromString">
<span class="methodName">addFromString</span>
</dt>
<dd>
<div class="brief">Appends a grammar to the grammars array
parameter based on text.</div>
<div class="synopsis">
<pre class="signature prettyprint">
void addFromString(DOMString string, optional float weight);
<span class="pln"></span>
</pre>
</div>
<div class="parameters">
<p>
<span class="param">Parameters:</span>
</p>
<ul>
<li class="param"><span class="name">string</span>: The string for the grammar.</li>
<li class="param"><span class="name">weight[optional]</span>: The weight the grammar.</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
</div>
<!-- -------------------------------- -->
<h2 id="full-webidl">3. Full WebIDL</h2>
<pre class="webidl prettyprint">
module Speech {
enum ErrorCode {"no-speech", "aborted", "audio-capture", "network", "not-allowed", "service-not-allowed", "bad-grammar", "language-not-supported"};
[NoInterfaceObject] interface SpeechManagerObject {
readonly attribute SpeechManager speech;
};
Tizen implements SpeechManagerObject;
[NoInterfaceObject] interface SpeechManager {
void vocalizeString(DOMString speakString);
};
[Constructor()]
interface SpeechRecognition : EventTarget {
attribute SpeechGrammarList grammars;
attribute DOMString lang;
attribute boolean continuous;
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute DOMString serviceURI;
void start();
void stop();
void abort();
attribute EventHandler onaudiostart;
attribute EventHandler onsoundstart;
attribute EventHandler onspeechstart;
attribute EventHandler onspeechend;
attribute EventHandler onsoundend;
attribute EventHandler onaudioend;
attribute EventHandler onresult;
attribute EventHandler onnomatch;
attribute EventHandler onerror;
attribute EventHandler onstart;
attribute EventHandler onend;
};
[NoInterfaceObject] interface SpeechRecognitionError : Event {
readonly attribute ErrorCode error;
readonly attribute DOMString message;
};
[NoInterfaceObject] interface SpeechRecognitionAlternative {
readonly attribute DOMString transcript;
readonly attribute float confidence;
};
[NoInterfaceObject] interface SpeechRecognitionResult {
readonly attribute unsigned long length;
SpeechRecognitionAlternative item(unsigned long index);
readonly attribute boolean final;
};
[NoInterfaceObject] interface SpeechRecognitionResultList {
readonly attribute unsigned long length;
SpeechRecognitionResult item(unsigned long index);
};
[NoInterfaceObject] interface SpeechRecognitionEvent : Event {
readonly attribute unsigned long resultIndex;
readonly attribute SpeechRecognitionResultList results;
readonly attribute any interpretation;
readonly attribute Document emma;
};
[Constructor()]
interface SpeechGrammar {
attribute DOMString src;
attribute float weight;
};
[Constructor()]
interface SpeechGrammarList {
readonly attribute unsigned long length;
SpeechGrammar item(unsigned long index);
void addFromURI(DOMString src, optional float weight);
void addFromString(DOMString string, optional float weight);
};
};
</pre>
<div id="footer">
<div class="copyright" align="center">
Except as noted, this content - excluding the Code Examples - is
licensed under <a
href="http://creativecommons.org/licenses/by/3.0/legalcode"
target="_blank">Creative Commons Attribution 3.0</a> and all of the
Code Examples contained herein are licensed under <a
href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.
<br>For details, see the <a
href="https://www.tizen.org/content-license" target="_blank">Content
License</a>.
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', 'UA-25976949-1' ]);
_gaq.push([ '_setDomainName', 'tizen.org' ]);
_gaq.push([ '_trackPageview' ]);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl'
: 'http://www')
+ '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</div>
</body>
</html>
|