Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
interface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
homeostasis
interface
Commits
70749636
Commit
70749636
authored
10 years ago
by
Benoit Favre
Browse files
Options
Downloads
Patches
Plain Diff
include slu and xml in config
parent
21e2463b
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.options.txt
+3
-3
3 additions, 3 deletions
.options.txt
asr.py
+1
-1
1 addition, 1 deletion
asr.py
asr/custom.cfg
+19
-0
19 additions, 0 deletions
asr/custom.cfg
main.py
+18
-16
18 additions, 16 deletions
main.py
selector.py
+16
-16
16 additions, 16 deletions
selector.py
with
57 additions
and
36 deletions
.options.txt
+
3
−
3
View file @
70749636
slu: 0
xml_filename: /home/favre/work/kaldi/interface-rocio/data/simple-example.xml
asr_model: asr/custom.cfg
osc_host: 127.0.0.1
xml_filename: /home/favre/work/kaldi/interface-rocio/data/homeostasis_25nov.xml
osc_port: 1234
asr_model: asr/custom.cfg
slu: 0
This diff is collapsed.
Click to expand it.
asr.py
+
1
−
1
View file @
70749636
...
...
@@ -65,7 +65,7 @@ class ASR(Gtk.HBox):
if
self
.
asr
:
import
config
for
name
,
value
in
config
.
read
(
asr_config_file
).
items
():
if
name
!=
'
dir
'
and
name
!=
'
name
'
:
if
name
!=
'
dir
'
and
name
!=
'
name
'
and
not
name
.
startswith
(
'
slu
'
)
and
not
name
.
startswith
(
'
xml
'
)
:
self
.
asr
.
set_property
(
name
,
value
)
else
:
print
>>
sys
.
stderr
,
"
Couldn
'
t create the kaldinnet2onlinedecoder element.
"
...
...
This diff is collapsed.
Click to expand it.
asr/custom.cfg
0 → 100644
+
19
−
0
View file @
70749636
dir
=
tools/model
name
=
Custom (compiled from simple-example.xml)
xml_filename
=
data/simple-example.xml
slu_prefix
=
$dir/automate/simple-example_%s
slu_actions
=
$dir/simple-example.action
fst
=
$dir/HCLG.fst
model
=
$dir/final.mdl
word-syms
=
$dir/words.txt
feature-type
=
mfcc
mfcc-config
=
$dir/conf/mfcc.conf
ivector-extraction-config
=
$dir/conf/ivector_extractor.fixed.conf
max-active
=
7000
beam
=
11.0
lattice-beam
=
6.0
do-endpointing
=
True
endpoint-silence-phones
=
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
This diff is collapsed.
Click to expand it.
main.py
+
18
−
16
View file @
70749636
...
...
@@ -28,9 +28,13 @@ import confirm, asr, actions, xmlview
import
levenstein
,
slu
,
osc
class
ScriptedASR
(
Gtk
.
Window
):
def
__init__
(
self
,
xml_filename
,
asr_config_file
,
osc_host
,
osc_port
,
slu_type
):
def
__init__
(
self
,
asr_config_file
,
osc_host
,
osc_port
,
slu_type
):
super
(
ScriptedASR
,
self
).
__init__
()
import
config
config_dict
=
config
.
read
(
asr_config_file
)
xml_filename
=
config_dict
[
'
xml_filename
'
]
self
.
connect
(
"
destroy
"
,
self
.
quit
)
self
.
set_default_size
(
1024
,
768
)
self
.
set_border_width
(
10
)
...
...
@@ -53,14 +57,19 @@ class ScriptedASR(Gtk.Window):
# slu
#prefix = 'slu/automate/homeostasis_25nov_%s'
#library = 'slu/src.new/librocio_slu.so'
prefix
=
'
tools/model/automate/simple-example_%s
'
library
=
'
tools/slu/src/librocio_slu.so
'
#prefix = 'tools/model/automate/simple-example_%s'
#library = 'tools/slu/src/librocio_slu.so'
slu_prefix
=
config_dict
[
'
slu_prefix
'
]
slu_actions
=
config_dict
[
'
slu_actions
'
]
slu_library
=
'
%s/tools/slu/src/librocio_slu.so
'
%
directory
self
.
slu
=
{}
for
section_fst
in
glob
.
glob
(
prefix
%
'
section*.fst
'
):
for
section_fst
in
glob
.
glob
(
slu_
prefix
%
'
section*.fst
'
):
found
=
re
.
search
(
'
section(\d+)\.fst$
'
,
section_fst
)
if
found
:
section_id
=
int
(
found
.
group
(
1
))
self
.
slu
[
section_id
-
1
]
=
slu
.
SLU
(
prefix
%
'
dico_word.txt
'
,
prefix
%
'
dico_action.txt
'
,
section_fst
,
prefix
%
'
clean_tail.fst
'
,
'
slu
/homeostasis_25nov.
action
'
,
library
=
library
)
self
.
slu
[
section_id
-
1
]
=
slu
.
SLU
(
slu_
prefix
%
'
dico_word.txt
'
,
slu_
prefix
%
'
dico_action.txt
'
,
section_fst
,
slu_
prefix
%
'
clean_tail.fst
'
,
slu
_
action
s
,
library
=
slu_
library
)
if
slu_type
==
0
:
for
keyword
in
self
.
xmlview
.
keywords
:
keyword
.
add_listener
(
self
.
set_slu_history
)
...
...
@@ -216,16 +225,9 @@ class ScriptedASR(Gtk.Window):
if
__name__
==
'
__main__
'
:
import
selector
xml_filename
=
'
data/homeostasis_25nov.xml
'
asr_config_file
=
'
asr/mika-fred-1.cfg
'
asr_config_file
=
'
asr/mika-fred-2.cfg
'
asr_config_file
=
'
asr/fisher-benoit-1.cfg
'
if
len
(
sys
.
argv
)
>
1
:
xml_filename
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
>
2
:
asr_config_file
=
sys
.
argv
[
2
]
xml_filename
,
asr_config_file
,
osc_host
,
osc_port
,
slu_type
=
selector
.
ModelSelector
(
xml_filename
,
asr_config_file
).
run
()
if
xml_filename
==
None
or
asr_config_file
==
None
or
osc_host
==
None
or
osc_port
==
None
or
slu_type
==
None
:
asr_config_file
=
'
asr/custom.cfg
'
asr_config_file
,
osc_host
,
osc_port
,
slu_type
=
selector
.
ModelSelector
(
asr_config_file
).
run
()
if
asr_config_file
==
None
or
osc_host
==
None
or
osc_port
==
None
or
slu_type
==
None
:
sys
.
exit
(
0
)
app
=
ScriptedASR
(
xml_filename
,
asr_config_file
,
osc_host
,
osc_port
,
slu_type
)
app
=
ScriptedASR
(
asr_config_file
,
osc_host
,
osc_port
,
slu_type
)
Gtk
.
main
()
This diff is collapsed.
Click to expand it.
selector.py
+
16
−
16
View file @
70749636
...
...
@@ -3,9 +3,9 @@ import os, sys, glob, re
import
config
class
ModelSelector
(
Gtk
.
Dialog
):
def
__init__
(
self
,
xml_filename
=
''
,
asr_model
=
''
):
def
__init__
(
self
,
asr_model
=
''
):
super
(
ModelSelector
,
self
).
__init__
()
self
.
options
=
{
'
xml_filename
'
:
xml_filename
,
'
asr_model
'
:
asr_model
,
'
osc_host
'
:
'
127.0.0.1
'
,
'
osc_port
'
:
'
1234
'
,
'
slu
'
:
'
Regular
'
}
self
.
options
=
{
'
asr_model
'
:
asr_model
,
'
osc_host
'
:
'
127.0.0.1
'
,
'
osc_port
'
:
'
1234
'
,
'
slu
'
:
'
Regular
'
}
self
.
load_options
()
self
.
set_title
(
'
Configuration
'
)
...
...
@@ -14,18 +14,18 @@ class ModelSelector(Gtk.Dialog):
self
.
add_button
(
"
OK
"
,
Gtk
.
ResponseType
.
OK
)
box
=
self
.
get_content_area
()
xml_box
=
Gtk
.
HBox
()
xml_box
.
pack_start
(
Gtk
.
Label
(
'
XML file:
'
),
False
,
False
,
5
)
xml_entry
=
Gtk
.
Entry
()
xml_entry
.
set_text
(
self
.
options
[
'
xml_filename
'
])
xml_entry
.
set_width_chars
(
len
(
self
.
options
[
'
xml_filename
'
]))
self
.
xml_entry
=
xml_entry
xml_box
.
pack_start
(
xml_entry
,
True
,
True
,
5
)
xml_button
=
Gtk
.
Button
(
"
Choose...
"
)
xml_button
.
connect
(
'
clicked
'
,
self
.
show_filechooser
)
xml_box
.
pack_start
(
xml_button
,
False
,
False
,
5
)
#
xml_box = Gtk.HBox()
#
xml_box.pack_start(Gtk.Label('XML file:'), False, False, 5)
#
xml_entry = Gtk.Entry()
#
xml_entry.set_text(self.options['xml_filename'])
#
xml_entry.set_width_chars(len(self.options['xml_filename']))
#
self.xml_entry = xml_entry
#
xml_box.pack_start(xml_entry, True, True, 5)
#
xml_button = Gtk.Button("Choose...")
#
xml_button.connect('clicked', self.show_filechooser)
#
xml_box.pack_start(xml_button, False, False, 5)
box
.
pack_start
(
xml_box
,
False
,
False
,
5
)
#
box.pack_start(xml_box, False, False, 5)
model_box
=
Gtk
.
HBox
()
model_box
.
pack_start
(
Gtk
.
Label
(
'
ASR model:
'
),
False
,
False
,
5
)
...
...
@@ -70,7 +70,7 @@ class ModelSelector(Gtk.Dialog):
box
.
pack_start
(
osc_box
,
False
,
False
,
5
)
self
.
xml_entry
.
set_activates_default
(
True
)
#
self.xml_entry.set_activates_default(True)
okButton
=
self
.
get_widget_for_response
(
response_id
=
Gtk
.
ResponseType
.
OK
)
okButton
.
set_can_default
(
True
)
okButton
.
grab_default
()
...
...
@@ -132,11 +132,11 @@ class ModelSelector(Gtk.Dialog):
if
response
!=
Gtk
.
ResponseType
.
OK
:
return
None
,
None
,
None
,
None
self
.
options
[
'
asr_model
'
]
=
self
.
models
[
self
.
model_chooser
.
get_active
()]
self
.
options
[
'
xml_filename
'
]
=
self
.
xml_entry
.
get_text
()
#
self.options['xml_filename'] = self.xml_entry.get_text()
self
.
options
[
'
osc_host
'
]
=
self
.
osc_host
.
get_text
()
self
.
options
[
'
osc_port
'
]
=
self
.
osc_port
.
get_text
()
self
.
options
[
'
slu
'
]
=
self
.
slu_chooser
.
get_active
()
self
.
save_options
()
self
.
destroy
()
return
self
.
options
[
'
xml_filename
'
],
self
.
options
[
'
asr_model
'
],
self
.
options
[
'
osc_host
'
],
self
.
options
[
'
osc_port
'
],
self
.
options
[
'
slu
'
]
return
self
.
options
[
'
asr_model
'
],
self
.
options
[
'
osc_host
'
],
self
.
options
[
'
osc_port
'
],
self
.
options
[
'
slu
'
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment