speechstate 2.0.0-beta.6 → 2.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.org +59 -11
- package/README.plantuml +3 -0
- package/README.png +0 -0
- package/dist/asr.js +1 -1
- package/dist/speechstate.d.ts +19 -12
- package/dist/speechstate.d.ts.map +1 -1
- package/package.json +1 -1
package/README.org
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#+STARTUP: inlineimages
|
|
1
2
|
#+TITLE: SpeechState
|
|
2
3
|
|
|
3
4
|
* SDK
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
interface Settings {
|
|
28
29
|
locale?: string;
|
|
29
30
|
azureCredentials: string | AzureCredentials;
|
|
31
|
+
azureLanguageCredentials?: AzureLanguageCredentials;
|
|
30
32
|
asrDefaultCompleteTimeout?: number;
|
|
31
33
|
asrDefaultNoInputTimeout?: number;
|
|
32
34
|
ttsDefaultVoice?: string;
|
|
@@ -48,7 +50,7 @@ Example action:
|
|
|
48
50
|
*** DM to SpeechState
|
|
49
51
|
- ~{ type: "PREPARE" }~
|
|
50
52
|
- ~{ type: "SPEAK"; value: Agenda }~
|
|
51
|
-
- ~{ type: "LISTEN" }~
|
|
53
|
+
- ~{ type: "LISTEN"; value?: RecogniseParameters }~
|
|
52
54
|
- ~{ type: "CONTROL" }~
|
|
53
55
|
- ~{ type: "STOP" }~
|
|
54
56
|
|
|
@@ -56,22 +58,38 @@ Example action:
|
|
|
56
58
|
*** SpeechState to DM
|
|
57
59
|
- ~{ type: "ASRTTS_READY" }~
|
|
58
60
|
- ~{ type: "ASR_NOINPUT" }~
|
|
59
|
-
- ~{ type: "RECOGNISED"; value: Hypothesis[] }~
|
|
61
|
+
- ~{ type: "RECOGNISED"; value: Hypothesis[]; nluValue?: any }~
|
|
60
62
|
- ~{ type: "SPEAK_COMPLETE" }~
|
|
61
63
|
- ~{ type: "ASR_STARTED" }~
|
|
62
64
|
- ~{ type: "TTS_STARTED" }~
|
|
63
65
|
** Types:
|
|
64
66
|
#+begin_src typescript
|
|
65
|
-
interface Hypothesis {
|
|
67
|
+
interface Hypothesis {
|
|
68
|
+
utterance: string;
|
|
69
|
+
confidence: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface Agenda {
|
|
66
73
|
utterance: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
voice?: string; // defaults to "en-US-DavisNeural"
|
|
75
|
+
streamURL?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface RecogniseParameters {
|
|
79
|
+
noInputTimeout?: number;
|
|
80
|
+
completeTimeout?: number;
|
|
81
|
+
locale?: string;
|
|
82
|
+
hints?: string[];
|
|
83
|
+
nlu?: boolean | AzureLanguageCredentials;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface AzureLanguageCredentials {
|
|
87
|
+
endpoint: string;
|
|
88
|
+
key: string;
|
|
89
|
+
projectName: string;
|
|
90
|
+
deploymentName: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
#+end_src
|
|
76
94
|
|
|
77
95
|
|
|
@@ -93,3 +111,33 @@ interface Agenda {
|
|
|
93
111
|
- Resource group: group name from the previous step
|
|
94
112
|
5. Within your Speech Service go to: *Resourse management → Keys and
|
|
95
113
|
Endpoint* and copy your KEY 1.
|
|
114
|
+
* Sequence diagrams
|
|
115
|
+
#+begin_src plantuml :results output replace :file docs/diagrams/dm-speechstate.svg :exports results
|
|
116
|
+
skinparam defaultFontName Helvetica
|
|
117
|
+
participant SpeechState as SS
|
|
118
|
+
hnote across: Initialization
|
|
119
|
+
create SS
|
|
120
|
+
DM -> SS : **spawn**
|
|
121
|
+
DM -> SS : PREPARE
|
|
122
|
+
SS -> DM : ASRTTS_READY
|
|
123
|
+
hnote across: Speech Synthesis
|
|
124
|
+
DM -> SS : LISTEN
|
|
125
|
+
activate SS
|
|
126
|
+
SS --> DM : TTS_STARTED
|
|
127
|
+
return SPEAK_COMPLETE
|
|
128
|
+
hnote across: Speech Recognition
|
|
129
|
+
DM -> SS : LISTEN
|
|
130
|
+
activate SS
|
|
131
|
+
SS --> DM : ASR_STARTED
|
|
132
|
+
return RECOGNISED
|
|
133
|
+
DM -> SS : LISTEN
|
|
134
|
+
activate SS
|
|
135
|
+
SS --> DM : ASR_STARTED
|
|
136
|
+
... > noInputTimeout ...
|
|
137
|
+
return ASR_NOINPUT
|
|
138
|
+
#+end_src
|
|
139
|
+
|
|
140
|
+
#+RESULTS:
|
|
141
|
+
[[file:docs/diagrams/dm-speechstate.svg]]
|
|
142
|
+
|
|
143
|
+
|
package/README.plantuml
ADDED
package/README.png
ADDED
|
Binary file
|
package/dist/asr.js
CHANGED
|
@@ -148,7 +148,7 @@ exports.asrMachine = (0, xstate_1.setup)({
|
|
|
148
148
|
on: {
|
|
149
149
|
START: {
|
|
150
150
|
target: "Recognising",
|
|
151
|
-
actions: (0, xstate_1.assign)({ params: ({ event }) => event.value }),
|
|
151
|
+
actions: (0, xstate_1.assign)({ params: ({ event }) => event.value || {} }),
|
|
152
152
|
},
|
|
153
153
|
},
|
|
154
154
|
},
|
package/dist/speechstate.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ interface SSContext {
|
|
|
5
5
|
asrRef?: any;
|
|
6
6
|
ttsRef?: any;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
/** events sent to the spawned `speechstate` machine **/
|
|
9
|
+
type SSEventExtIn = {
|
|
9
10
|
type: "PREPARE";
|
|
10
11
|
} | {
|
|
11
12
|
type: "CONTROL";
|
|
@@ -14,28 +15,34 @@ type SSEvent = {
|
|
|
14
15
|
} | {
|
|
15
16
|
type: "SPEAK";
|
|
16
17
|
value: Agenda;
|
|
17
|
-
} | {
|
|
18
|
-
type: "TTS_READY";
|
|
19
|
-
} | {
|
|
20
|
-
type: "TTS_STARTED";
|
|
21
|
-
} | {
|
|
22
|
-
type: "TTS_ERROR";
|
|
23
|
-
} | {
|
|
24
|
-
type: "SPEAK_COMPLETE";
|
|
25
|
-
} | {
|
|
26
|
-
type: "ASR_READY";
|
|
27
18
|
} | {
|
|
28
19
|
type: "LISTEN";
|
|
29
20
|
value: RecogniseParameters;
|
|
21
|
+
};
|
|
22
|
+
/** for sendParent, not type-checked */
|
|
23
|
+
type SSEventExtOut = {
|
|
24
|
+
type: "ASR_NOINPUT";
|
|
25
|
+
} | {
|
|
26
|
+
type: "ASRTTS_READY";
|
|
30
27
|
} | {
|
|
31
28
|
type: "ASR_STARTED";
|
|
32
29
|
} | {
|
|
33
|
-
type: "
|
|
30
|
+
type: "TTS_STARTED";
|
|
31
|
+
} | {
|
|
32
|
+
type: "SPEAK_COMPLETE";
|
|
34
33
|
} | {
|
|
35
34
|
type: "RECOGNISED";
|
|
36
35
|
value: Hypothesis[];
|
|
37
36
|
nluValue?: any;
|
|
38
37
|
};
|
|
38
|
+
type SSEventIntIn = {
|
|
39
|
+
type: "TTS_READY";
|
|
40
|
+
} | {
|
|
41
|
+
type: "ASR_READY";
|
|
42
|
+
} | {
|
|
43
|
+
type: "TTS_ERROR";
|
|
44
|
+
};
|
|
45
|
+
type SSEvent = SSEventIntIn | SSEventExtIn | SSEventExtOut;
|
|
39
46
|
declare const speechstate: import("xstate").StateMachine<SSContext, SSEvent, Record<string, import("xstate").AnyActorRef>, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, string, import("xstate").StateValue, string, Settings, {}, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, SSEvent, import("xstate").ProvidedActor, import("xstate").ParameterizedObject, import("xstate").ParameterizedObject, string, string>>;
|
|
40
47
|
export { speechstate };
|
|
41
48
|
//# sourceMappingURL=speechstate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"speechstate.d.ts","sourceRoot":"","sources":["../src/speechstate.ts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