summaryrefslogtreecommitdiff
path: root/python-emora-stdm.spec
blob: 411507ffd3b8d455a0aca95f0f894f4ebff4a23f (plain)
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
%global _empty_manifest_terminate_build 0
Name:		python-emora-stdm
Version:	2.0.5
Release:	1
Summary:	Library for creating state-machine-based chatbots.
License:	MIT License
URL:		https://github.com/emora-chat/EmoraSTDM.git
Source0:	https://mirrors.aliyun.com/pypi/web/packages/62/a6/a0603735908f3c64cc128d238a514a14528f08a0fa1381687bcf371549f4/emora-stdm-2.0.5.tar.gz
BuildArch:	noarch

Requires:	python3-structpy
Requires:	python3-lark-parser
Requires:	python3-regex
Requires:	python3-nltk
Requires:	python3-importlib-resources
Requires:	python3-pytz
Requires:	python3-dill
Requires:	python3-pathos
Requires:	python3-contractions
Requires:	python3-num2words

%description
# State Transition Dialogue Manager

Emora State Transition Dialogue Manager (Emora STDM) is a dialogue system development framework that seamlessly integrates intent classification, pattern recognition, state machine, and information state approaches to dialogue management and natural language understanding. This allows Emora STDM to support both rapid prototyping and long-term, team-based development workflows, catering to a wide range of developer expertise.

Novice developers, or those who just want to develop a dialogue agent as quickly as possible, can easily create a state machine based chatbot using built-in functionality for intent classification and keyword matching. 

Emora STDM also affords a high degree of controllability to experts: it is easy to integrate NLP models, database queries, and custom logic, and chatbots can be created entirely from state update rules, following an information state approach ([ref](https://people.ict.usc.edu/~traum/Papers/traumlarsson.pdf)) to dialogue. Although we provide a host of built-in NLP models and useful functionality, your imagination is the limit when extending Emora STDM.

Links: [Github](https://github.com/emora-chat/emora_stdm)  [Paper](https://arxiv.org/abs/2006.06143)

# Quick Start

## Installation
```
pip install emora_stdm
```

Once installed, see if you can run the Hello World example below, and check out the [tutorials](https://github.com/emora-chat/emora_stdm/blob/master/README.md#tutorials).

## Hello World Example

Below is an example of a simple chatbot created with Emora STDM.
The easiest way to add content to a chatbot is to use this nested dictionary syntax.

```python3
from emora_stdm import DialogueFlow

chatbot = DialogueFlow('start')
transitions = {
    'state': 'start',
    '"Hello. How are you?"': {
        '[{good, okay, fine}]': {
            '"Good. I am doing well too."': {
                'error': {
                    '"See you later!"': 'end'
                }
            }
        },
        'error': {
            '"Well I hope your day gets better!"': {
                'error': {
                    '"Bye!"': 'end'
                }
            }
        }
    }
}
chatbot.load_transitions(transitions)

chatbot.run()
```
Running the above code will allow you to interact with this chatbot.
It asks how you are doing, and will respond differently depending on whether or not you included one of the keywords {"good", "fine", "okay"} in your answer. Below is a sample conversation produced by running the above code 
(S for system, U for user utterance):

```
S: Hello. How are you?
U: I'm good. How are you?
S: Good. I am doing well too.
U: Great!
S: See you later!
```

# Description

![overview image](https://github.com/emora-chat/emora_stdm/blob/master/docs/Approach_%20Demo_%20emora_stdm.svg)

Dialogue management in Emora STDM is performed in two ways: 
1) updating the state machine defined by the *Dialogue Graph* and 
2) applying information state *Update Rules*, which are structured as if...then... conditionals. 

Each turn of conversation,the Dialogue Graph is updated to interpret the user input and provide an appropriate response.
The Dialogue Graph is a state machine describing possible "pathways" of conversation, where each transition/edge represents either a sysem or user turn, and each state/node represents a set of options for what could be said next.
A full turn of conversation (user input + system response) results in two Dialogue Graph State updates--one representing an interpretation of the user turn, and the second representing a decision of the system for how to respond.

**On the user's turn**, each transition out of the current Dialogue Graph State (node) represents a unique interpretation of the user input.
The user input is evaluated against each out transition, and when a transition matches, the Dialogue Graph State is updated to the target of the transition.
(Note that the user input will *always* match a transition marked as `'error'`, but this transition is only accepted if no other transitions match the input).

**During the system turn**, each outgoing transition from the current Dialogue Graph State is a possible response. 
The system will select one of these response options based on a priority score of each transition, or randomly if the priorities of all the options are the same.
The selected transition will be used to produce the system response, and update the Dialogue Graph State.


Most simple dialogue agents will not have any update rules.
However, Update Rules can very useful to maninpulate state variables and perform complex interactions.
Before updating the Dialogue Graph, Update Rules are iteratively applied by evaluating each of their precondition Natexes on the user input, and applying the postcondition if the precondition succeeds.
The iteration continues until no more rules preconditions pass, at which point the Dialogue Graph update is performed.
You can read more about Update Rules in the [Update Rules Tutorial](/docs/UpdateRulesTutorial.md).

# Tutorials

* [**Dialogue Graph Tutorial**](/docs/DialogueGraphTutorial.md), explaining the core dialogue management functionality of Emora STDM
* [**Natex Tutorial**](/docs/NatexTutorial.md), explaining the framework's core natural language understanding and generation functionality
* [**Update Rules Tutorial**](/docs/UpdateRulesTutorial.md), explaining how to create dialogue agents using Update Rules instead of the Dialogue Graph 
* [Ontology Example](/docs/OntologyTutorial.md), showing how to use an ontology to efficiently categorize entities.
* [Multiple Components Example](/docs/MultipleComponentsTutorial.md), a quick example of multiple dialogue agents being combined into a single larger system.



%package -n python3-emora-stdm
Summary:	Library for creating state-machine-based chatbots.
Provides:	python-emora-stdm
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-emora-stdm
# State Transition Dialogue Manager

Emora State Transition Dialogue Manager (Emora STDM) is a dialogue system development framework that seamlessly integrates intent classification, pattern recognition, state machine, and information state approaches to dialogue management and natural language understanding. This allows Emora STDM to support both rapid prototyping and long-term, team-based development workflows, catering to a wide range of developer expertise.

Novice developers, or those who just want to develop a dialogue agent as quickly as possible, can easily create a state machine based chatbot using built-in functionality for intent classification and keyword matching. 

Emora STDM also affords a high degree of controllability to experts: it is easy to integrate NLP models, database queries, and custom logic, and chatbots can be created entirely from state update rules, following an information state approach ([ref](https://people.ict.usc.edu/~traum/Papers/traumlarsson.pdf)) to dialogue. Although we provide a host of built-in NLP models and useful functionality, your imagination is the limit when extending Emora STDM.

Links: [Github](https://github.com/emora-chat/emora_stdm)  [Paper](https://arxiv.org/abs/2006.06143)

# Quick Start

## Installation
```
pip install emora_stdm
```

Once installed, see if you can run the Hello World example below, and check out the [tutorials](https://github.com/emora-chat/emora_stdm/blob/master/README.md#tutorials).

## Hello World Example

Below is an example of a simple chatbot created with Emora STDM.
The easiest way to add content to a chatbot is to use this nested dictionary syntax.

```python3
from emora_stdm import DialogueFlow

chatbot = DialogueFlow('start')
transitions = {
    'state': 'start',
    '"Hello. How are you?"': {
        '[{good, okay, fine}]': {
            '"Good. I am doing well too."': {
                'error': {
                    '"See you later!"': 'end'
                }
            }
        },
        'error': {
            '"Well I hope your day gets better!"': {
                'error': {
                    '"Bye!"': 'end'
                }
            }
        }
    }
}
chatbot.load_transitions(transitions)

chatbot.run()
```
Running the above code will allow you to interact with this chatbot.
It asks how you are doing, and will respond differently depending on whether or not you included one of the keywords {"good", "fine", "okay"} in your answer. Below is a sample conversation produced by running the above code 
(S for system, U for user utterance):

```
S: Hello. How are you?
U: I'm good. How are you?
S: Good. I am doing well too.
U: Great!
S: See you later!
```

# Description

![overview image](https://github.com/emora-chat/emora_stdm/blob/master/docs/Approach_%20Demo_%20emora_stdm.svg)

Dialogue management in Emora STDM is performed in two ways: 
1) updating the state machine defined by the *Dialogue Graph* and 
2) applying information state *Update Rules*, which are structured as if...then... conditionals. 

Each turn of conversation,the Dialogue Graph is updated to interpret the user input and provide an appropriate response.
The Dialogue Graph is a state machine describing possible "pathways" of conversation, where each transition/edge represents either a sysem or user turn, and each state/node represents a set of options for what could be said next.
A full turn of conversation (user input + system response) results in two Dialogue Graph State updates--one representing an interpretation of the user turn, and the second representing a decision of the system for how to respond.

**On the user's turn**, each transition out of the current Dialogue Graph State (node) represents a unique interpretation of the user input.
The user input is evaluated against each out transition, and when a transition matches, the Dialogue Graph State is updated to the target of the transition.
(Note that the user input will *always* match a transition marked as `'error'`, but this transition is only accepted if no other transitions match the input).

**During the system turn**, each outgoing transition from the current Dialogue Graph State is a possible response. 
The system will select one of these response options based on a priority score of each transition, or randomly if the priorities of all the options are the same.
The selected transition will be used to produce the system response, and update the Dialogue Graph State.


Most simple dialogue agents will not have any update rules.
However, Update Rules can very useful to maninpulate state variables and perform complex interactions.
Before updating the Dialogue Graph, Update Rules are iteratively applied by evaluating each of their precondition Natexes on the user input, and applying the postcondition if the precondition succeeds.
The iteration continues until no more rules preconditions pass, at which point the Dialogue Graph update is performed.
You can read more about Update Rules in the [Update Rules Tutorial](/docs/UpdateRulesTutorial.md).

# Tutorials

* [**Dialogue Graph Tutorial**](/docs/DialogueGraphTutorial.md), explaining the core dialogue management functionality of Emora STDM
* [**Natex Tutorial**](/docs/NatexTutorial.md), explaining the framework's core natural language understanding and generation functionality
* [**Update Rules Tutorial**](/docs/UpdateRulesTutorial.md), explaining how to create dialogue agents using Update Rules instead of the Dialogue Graph 
* [Ontology Example](/docs/OntologyTutorial.md), showing how to use an ontology to efficiently categorize entities.
* [Multiple Components Example](/docs/MultipleComponentsTutorial.md), a quick example of multiple dialogue agents being combined into a single larger system.



%package help
Summary:	Development documents and examples for emora-stdm
Provides:	python3-emora-stdm-doc
%description help
# State Transition Dialogue Manager

Emora State Transition Dialogue Manager (Emora STDM) is a dialogue system development framework that seamlessly integrates intent classification, pattern recognition, state machine, and information state approaches to dialogue management and natural language understanding. This allows Emora STDM to support both rapid prototyping and long-term, team-based development workflows, catering to a wide range of developer expertise.

Novice developers, or those who just want to develop a dialogue agent as quickly as possible, can easily create a state machine based chatbot using built-in functionality for intent classification and keyword matching. 

Emora STDM also affords a high degree of controllability to experts: it is easy to integrate NLP models, database queries, and custom logic, and chatbots can be created entirely from state update rules, following an information state approach ([ref](https://people.ict.usc.edu/~traum/Papers/traumlarsson.pdf)) to dialogue. Although we provide a host of built-in NLP models and useful functionality, your imagination is the limit when extending Emora STDM.

Links: [Github](https://github.com/emora-chat/emora_stdm)  [Paper](https://arxiv.org/abs/2006.06143)

# Quick Start

## Installation
```
pip install emora_stdm
```

Once installed, see if you can run the Hello World example below, and check out the [tutorials](https://github.com/emora-chat/emora_stdm/blob/master/README.md#tutorials).

## Hello World Example

Below is an example of a simple chatbot created with Emora STDM.
The easiest way to add content to a chatbot is to use this nested dictionary syntax.

```python3
from emora_stdm import DialogueFlow

chatbot = DialogueFlow('start')
transitions = {
    'state': 'start',
    '"Hello. How are you?"': {
        '[{good, okay, fine}]': {
            '"Good. I am doing well too."': {
                'error': {
                    '"See you later!"': 'end'
                }
            }
        },
        'error': {
            '"Well I hope your day gets better!"': {
                'error': {
                    '"Bye!"': 'end'
                }
            }
        }
    }
}
chatbot.load_transitions(transitions)

chatbot.run()
```
Running the above code will allow you to interact with this chatbot.
It asks how you are doing, and will respond differently depending on whether or not you included one of the keywords {"good", "fine", "okay"} in your answer. Below is a sample conversation produced by running the above code 
(S for system, U for user utterance):

```
S: Hello. How are you?
U: I'm good. How are you?
S: Good. I am doing well too.
U: Great!
S: See you later!
```

# Description

![overview image](https://github.com/emora-chat/emora_stdm/blob/master/docs/Approach_%20Demo_%20emora_stdm.svg)

Dialogue management in Emora STDM is performed in two ways: 
1) updating the state machine defined by the *Dialogue Graph* and 
2) applying information state *Update Rules*, which are structured as if...then... conditionals. 

Each turn of conversation,the Dialogue Graph is updated to interpret the user input and provide an appropriate response.
The Dialogue Graph is a state machine describing possible "pathways" of conversation, where each transition/edge represents either a sysem or user turn, and each state/node represents a set of options for what could be said next.
A full turn of conversation (user input + system response) results in two Dialogue Graph State updates--one representing an interpretation of the user turn, and the second representing a decision of the system for how to respond.

**On the user's turn**, each transition out of the current Dialogue Graph State (node) represents a unique interpretation of the user input.
The user input is evaluated against each out transition, and when a transition matches, the Dialogue Graph State is updated to the target of the transition.
(Note that the user input will *always* match a transition marked as `'error'`, but this transition is only accepted if no other transitions match the input).

**During the system turn**, each outgoing transition from the current Dialogue Graph State is a possible response. 
The system will select one of these response options based on a priority score of each transition, or randomly if the priorities of all the options are the same.
The selected transition will be used to produce the system response, and update the Dialogue Graph State.


Most simple dialogue agents will not have any update rules.
However, Update Rules can very useful to maninpulate state variables and perform complex interactions.
Before updating the Dialogue Graph, Update Rules are iteratively applied by evaluating each of their precondition Natexes on the user input, and applying the postcondition if the precondition succeeds.
The iteration continues until no more rules preconditions pass, at which point the Dialogue Graph update is performed.
You can read more about Update Rules in the [Update Rules Tutorial](/docs/UpdateRulesTutorial.md).

# Tutorials

* [**Dialogue Graph Tutorial**](/docs/DialogueGraphTutorial.md), explaining the core dialogue management functionality of Emora STDM
* [**Natex Tutorial**](/docs/NatexTutorial.md), explaining the framework's core natural language understanding and generation functionality
* [**Update Rules Tutorial**](/docs/UpdateRulesTutorial.md), explaining how to create dialogue agents using Update Rules instead of the Dialogue Graph 
* [Ontology Example](/docs/OntologyTutorial.md), showing how to use an ontology to efficiently categorize entities.
* [Multiple Components Example](/docs/MultipleComponentsTutorial.md), a quick example of multiple dialogue agents being combined into a single larger system.



%prep
%autosetup -n emora-stdm-2.0.5

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-emora-stdm -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.5-1
- Package Spec generated