Galatea Dialog Studio: script sources. Migrated from CVS repository.
Revisão | 6af4f6b0dbc6cb96d437ec6357941f5aa5ca7e21 (tree) |
---|---|
Hora | 2010-05-30 00:27:22 |
Autor | Takuya Nishimoto <nishimotz@gmai...> |
Commiter | Takuya Nishimoto |
20100530-1
@@ -1,8 +1,9 @@ | ||
1 | 1 | #!/usr/bin/ruby -Ku |
2 | 2 | $runner_dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) |
3 | 3 | $skel_dir = File.expand_path(File.join(File.dirname(__FILE__), '../skel')) |
4 | +$tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '../tmp')) | |
4 | 5 | $generator_dir = "<%= $generator_dir %>" |
5 | -[ $runner_dir, $generator_dir, "/usr/local/galatea-dialog/files" ].each do |d| | |
6 | +[ $runner_dir, $generator_dir ].each do |d| | |
6 | 7 | f = File.join(d, 'lib', 'galatea_runner.rb') |
7 | 8 | if File.exist?(f) |
8 | 9 | $library_dir = File.join(d , 'lib') |
@@ -1,6 +1,5 @@ | ||
1 | 1 | #!/usr/bin/ruby -Ku |
2 | 2 | # coding: utf-8 |
3 | -# $Id: galatea_config_maker.rb,v 1.20 2009/09/10 05:21:04 nishimoto Exp $ | |
4 | 3 | # (c) Takuya NISHIMOTO |
5 | 4 | |
6 | 5 | require 'fileutils' |
@@ -10,6 +9,7 @@ | ||
10 | 9 | attr_accessor :runner_skel_path |
11 | 10 | attr_accessor :verbose |
12 | 11 | attr_writer :preprocess_only |
12 | + attr_accessor :runner_tmp_dir | |
13 | 13 | |
14 | 14 | def initialize(file_array) |
15 | 15 | super |
@@ -18,6 +18,11 @@ | ||
18 | 18 | else |
19 | 19 | @runner_skel_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'skel')) |
20 | 20 | end |
21 | + if $tmp_dir | |
22 | + @runner_tmp_dir = $tmp_dir | |
23 | + else | |
24 | + @runner_tmp_dir = p('dm.tmp_dir') | |
25 | + end | |
21 | 26 | @errors = [] |
22 | 27 | end |
23 | 28 |
@@ -35,28 +40,27 @@ | ||
35 | 40 | end |
36 | 41 | |
37 | 42 | def mkdir_tmppath |
38 | - tmp = p('dm.tmp_dir') | |
39 | - unless File.exists?(tmp) | |
40 | - FileUtils.mkdir_p tmp | |
43 | + unless File.exists?(@runner_tmp_dir) | |
44 | + FileUtils.mkdir_p @runner_tmp_dir | |
41 | 45 | end |
42 | - File.chmod 0755, tmp | |
46 | + File.chmod 0755, @runner_tmp_dir | |
43 | 47 | end |
44 | 48 | |
45 | 49 | def set_lang(lang) |
46 | 50 | @srm_lang = lang |
47 | 51 | @dm_language = lang |
48 | - if lang == 'ja' | |
49 | - # @srm_binhmm = 'hmmdefs,ptm,gid.binhmm' | |
50 | - # @am_commands_ssm = "cd #{p('enginepath')}/SSM/gtalk ; ./gtalk -C #{@tmppath}/ssm.conf" | |
51 | - else # 'en' | |
52 | - # @srm_binhmm = 'hmmdefs_mix16_gid.binhmm' | |
53 | - # @am_commands_ssm = "#{p('ruby.bin')} ./SSM-espeak.rb" | |
54 | - end | |
52 | + #if lang == 'ja' | |
53 | + # # @srm_binhmm = 'hmmdefs,ptm,gid.binhmm' | |
54 | + # # @am_commands_ssm = "cd #{p('enginepath')}/SSM/gtalk ; ./gtalk -C #{@tmppath}/ssm.conf" | |
55 | + #else # 'en' | |
56 | + # # @srm_binhmm = 'hmmdefs_mix16_gid.binhmm' | |
57 | + # # @am_commands_ssm = "#{p('ruby.bin')} ./SSM-espeak.rb" | |
58 | + #end | |
55 | 59 | end |
56 | 60 | |
57 | 61 | def make(file) |
58 | 62 | begin |
59 | - File.open("#{p('dm.tmp_dir')}/#{file}", "w") do |outfile| | |
63 | + File.open("#{@runner_tmp_dir}/#{file}", "w") do |outfile| | |
60 | 64 | str = File.open("#{runner_skel_path}/#{file}.txt", "r").read |
61 | 65 | outfile.write translate(str) |
62 | 66 | end |
@@ -66,37 +70,35 @@ | ||
66 | 70 | end |
67 | 71 | end |
68 | 72 | |
69 | - def env_ok? | |
70 | - files = [ | |
71 | - "#{p('srm.julius.engine_dir')}/bin/julius", | |
72 | - "#{p('ssm.gtalk.engine_dir')}/gtalk", | |
73 | - "#{p('ssm.gtalk.chasen_dir')}/bin/chasen", | |
74 | - "#{p('ssm.gtalk.chaone_dir')}/chaone", | |
75 | - "#{p('fsm.galateafsm.engine_dir')}/fsm", | |
76 | - ] | |
77 | - files.each do |f| | |
78 | - unless File.stat(f).executable? | |
79 | - @errors << "#{f} is not executable" | |
80 | - end | |
81 | - end | |
82 | - return false if @errors.size > 0 | |
83 | - true | |
84 | - end | |
73 | + #def env_ok? | |
74 | + # files = [ | |
75 | + # "#{p('srm.julius.engine_dir')}/bin/julius", | |
76 | + # "#{p('ssm.gtalk.engine_dir')}/gtalk", | |
77 | + # "#{p('ssm.gtalk.chasen_dir')}/bin/chasen", | |
78 | + # "#{p('ssm.gtalk.chaone_dir')}/chaone", | |
79 | + # "#{p('fsm.galateafsm.engine_dir')}/fsm", | |
80 | + # ] | |
81 | + # files.each do |f| | |
82 | + # unless File.stat(f).executable? | |
83 | + # @errors << "#{f} is not executable" | |
84 | + # end | |
85 | + # end | |
86 | + # return false if @errors.size > 0 | |
87 | + # true | |
88 | + #end | |
85 | 89 | |
86 | 90 | def runner_cmd |
87 | 91 | if @preprocess_only |
88 | 92 | classpath = p('javascript.jar') + ":" + p('dm.jar') |
89 | - tmp_dir = p('dm.tmp_dir') | |
90 | 93 | java_bin = p('java.bin') |
91 | - c = "#{java_bin} -cp #{classpath} galatea.dialog.DialogManager -c #{tmp_dir}/gdm.conf" + " -p " + @dm_options | |
94 | + c = "#{java_bin} -cp #{classpath} galatea.dialog.DialogManager -c #{@runner_tmp_dir}/gdm.conf" + " -p " + @dm_options | |
92 | 95 | puts c |
93 | 96 | return c |
94 | 97 | end |
95 | 98 | perl_bin = p('perl.bin') |
96 | - encoding = p('dm.encoding') | |
99 | + # encoding = p('dm.encoding') | |
97 | 100 | am_perl = "./AgentManager-gdm.pl" |
98 | - env = "export LANG=#{encoding};export LC_ALL=#{encoding};export PERL_BADLANG=0;export AUDIODEV=#{p('ssm.gtalk.audiodev')}" | |
99 | - "#{env}; cd #{p('dm.modules_dir')}; #{perl_bin} #{am_perl} -C #{p('dm.tmp_dir')}/am.conf" | |
101 | + "#{p('runner.env')}; cd #{p('dm.modules_dir')}; #{perl_bin} #{am_perl} -C #{@runner_tmp_dir}/am.conf" | |
100 | 102 | end |
101 | 103 | |
102 | 104 | end |
@@ -1,6 +1,5 @@ | ||
1 | 1 | #!/usr/bin/ruby -Ku |
2 | 2 | # coding: utf-8 |
3 | -# $Id: galatea_runner.rb,v 1.14 2009/09/10 05:21:04 nishimoto Exp $ | |
4 | 3 | # (c) Takuya NISHIMOTO |
5 | 4 | |
6 | 5 | require 'optparse' |
@@ -22,7 +21,7 @@ | ||
22 | 21 | if $generator_dir |
23 | 22 | ar << File.join($generator_dir, 'runner.yml') |
24 | 23 | end |
25 | -ar << "/usr/local/galatea-dialog/files/runner.yml" | |
24 | +ar << "/usr/local/galatea-dialog/runner.yml" | |
26 | 25 | puts "[config candidate] " + ar.join(' ') |
27 | 26 | ar.each do |f| |
28 | 27 | if File.exist?(f) |
@@ -65,10 +64,10 @@ | ||
65 | 64 | %w[ julius.conf gdm.conf fsm.conf ssm.conf chasenrc-euc-jp am.conf am_mcl.conf ].each do |f| |
66 | 65 | m.make f |
67 | 66 | end |
68 | -unless m.env_ok? | |
69 | - puts m.errors.join("\n") | |
70 | - exit | |
71 | -end | |
67 | +#unless m.env_ok? | |
68 | +# puts m.errors.join("\n") | |
69 | +# exit | |
70 | +#end | |
72 | 71 | if rails_server |
73 | 72 | server_cmd = "#{m.p('rails.ruby.bin')} #{rails_server}/script/server" |
74 | 73 | else |
@@ -5,9 +5,11 @@ | ||
5 | 5 | <% chaone_dir = '/usr/local/galatea-ja-morph/chaone' -%> |
6 | 6 | <% unidic_dir = '/usr/local/galatea-ja-morph/unidic' -%> |
7 | 7 | <% dialog_dir = $generator_dir -%> |
8 | +runner: | |
9 | + env: export LANG=ja_JP.UTF-8 | |
8 | 10 | dm: |
9 | 11 | lang: ja |
10 | - encoding: ja_JP.eucJP | |
12 | + #encoding: ja_JP.UTF-8 | |
11 | 13 | jar: <%= $generator_dir %>/jar/gdm.jar |
12 | 14 | default_vxml: <%= dialog_dir %>/lib/default.vxml |
13 | 15 | modules_dir: <%= dialog_dir %>/Modules |
@@ -16,12 +18,12 @@ | ||
16 | 18 | julius: |
17 | 19 | engine_dir: <%= engine_dir %>/SRM |
18 | 20 | ssm: |
21 | + dir: <%= engine_dir %>/SSM | |
19 | 22 | gtalk: |
20 | - engine_dir: <%= engine_dir %>/SSM/gtalk | |
23 | + engine_dir: <%= $generator_dir %>/bin | |
21 | 24 | chasen_dir: <%= chasen_dir %> |
22 | 25 | chaone_dir: <%= chaone_dir %> |
23 | 26 | unidic_dir: <%= unidic_dir %> |
24 | - audiodev: /dev/dsp | |
25 | 27 | fsm: |
26 | 28 | galateafsm: |
27 | 29 | engine_dir: <%= engine_dir %>/FSM/bin |
@@ -4,13 +4,12 @@ | ||
4 | 4 | # |
5 | 5 | <% |
6 | 6 | classpath = p('javascript.jar') + ":" + p('dm.jar') |
7 | -tmp_dir = p('dm.tmp_dir') | |
8 | 7 | java_bin = p('java.bin') |
9 | 8 | ruby_bin = p('ruby.bin') |
10 | -am_commands_dm = "#{java_bin} -cp #{classpath} galatea.dialog.DialogManager -c #{tmp_dir}/gdm.conf" + " " + @dm_options | |
11 | -am_commands_fsm = "cd #{p('fsm.galateafsm.engine_dir')}; ./fsm -C #{tmp_dir}/fsm.conf" | |
12 | -am_commands_fs_mcl = "#{java_bin} -cp #{classpath} galatea.agent.BehaviorManager -c #{tmp_dir}/gdm.conf" | |
13 | -am_commands_ssm = "cd #{p('ssm.gtalk.engine_dir')}; /usr/bin/padsp ./gtalk -C #{tmp_dir}/ssm.conf" | |
9 | +am_commands_dm = "#{java_bin} -cp #{classpath} galatea.dialog.DialogManager -c #{@runner_tmp_dir}/gdm.conf" + " " + @dm_options | |
10 | +am_commands_fsm = "cd #{p('fsm.galateafsm.engine_dir')}; ./fsm -C #{@runner_tmp_dir}/fsm.conf" | |
11 | +am_commands_fs_mcl = "#{java_bin} -cp #{classpath} galatea.agent.BehaviorManager -c #{@runner_tmp_dir}/gdm.conf" | |
12 | +am_commands_ssm = "cd #{p('ssm.gtalk.engine_dir')}; /usr/bin/padsp ./gtalk -C #{@runner_tmp_dir}/ssm.conf" | |
14 | 13 | %> |
15 | 14 | #------------------------------------------------------------------ |
16 | 15 | broadcast: AM-MCL FS-MCL PAR DM |
@@ -25,7 +24,7 @@ | ||
25 | 24 | module:FSM commands: <%= am_commands_fsm %> |
26 | 25 | module:SSM commands: <%= am_commands_ssm %> |
27 | 26 | module:FS-MCL commands: <%= am_commands_fs_mcl %> |
28 | -module:AM-MCL commands: <%= ruby_bin %> AM-MCL.rb -C <%= tmp_dir %>/am_mcl.conf | |
27 | +module:AM-MCL commands: <%= ruby_bin %> AM-MCL.rb -C <%= @runner_tmp_dir %>/am_mcl.conf | |
29 | 28 | module:PAR commands: <%= ruby_bin %> PAR.rb |
30 | 29 | module:DIM commands: <%= ruby_bin %> DIM.rb |
31 | 30 | #----- EOF -------------------------------------------------------- |
@@ -28,7 +28,7 @@ | ||
28 | 28 | BackgroundFile bg2 <%= sample %>/BG/bg2.png |
29 | 29 | BackgroundFile bg3 <%= sample %>/BG/bg3.png |
30 | 30 | BackgroundFile bg4 <%= sample %>/BG/bg4.png |
31 | -<% dir = p('fsm.tests_path') -%> | |
31 | +<% dir = p('fsm.galateafsm.tests_dir') -%> | |
32 | 32 | <% if File.exists?("#{dir}/castle01.bmp") -%> |
33 | 33 | BackgroundFile castle01 <%= dir %>/castle01.bmp |
34 | 34 | BackgroundFile castle02 <%= dir %>/castle02.bmp |
@@ -6,9 +6,9 @@ | ||
6 | 6 | srm_lang = p('dm.lang') |
7 | 7 | grammar_mkdfa_dir = p('srm.julius.engine_dir') + "/bin" |
8 | 8 | grammar_mkdfa_exe = "mkdfa.pl" |
9 | -grammar_work_dir = p('dm.tmp_dir') | |
9 | + | |
10 | 10 | julius_server_runner_dir = p('srm.julius.engine_dir') |
11 | -julius_server_runner_arg = "-C #{grammar_work_dir}/julius.conf" | |
11 | +julius_server_runner_arg = "-C #{@runner_tmp_dir}/julius.conf" | |
12 | 12 | julius_server_runner_exe = p('srm.julius.bin') || p('srm.julius.engine_dir') + "/bin/julius" |
13 | 13 | %> |
14 | 14 |
@@ -32,7 +32,7 @@ | ||
32 | 32 | Grammar.Mkdfa.Dir : <%= grammar_mkdfa_dir %> |
33 | 33 | Grammar.Mkdfa.Exe : <%= grammar_mkdfa_exe %> |
34 | 34 | Grammar.Mkdfa.Perl : <%= p('perl.bin') %> |
35 | -Grammar.WorkDir : <%= grammar_work_dir %> | |
35 | +Grammar.WorkDir : <%= @runner_tmp_dir %> | |
36 | 36 | Grammar.TemplateResourcePath : /res/grammar/grammar-<%= srm_lang %>.xml |
37 | 37 | Grammar.UseMkdfaExe : 0 |
38 | 38 |
@@ -1,10 +1,10 @@ | ||
1 | 1 | # configuratiuon file for gtalk (GalateaTalk) |
2 | 2 | |
3 | -AUDIODEV: <%= p('ssm.gtalk.audiodev') %> | |
3 | +#AUDIODEV: <%= p('ssm.gtalk.audiodev') %> | |
4 | 4 | |
5 | 5 | CHASEN: <%= p('ssm.gtalk.chasen_dir') %>/bin/chasen |
6 | 6 | CHAONE: <%= p('ssm.gtalk.chaone_dir') %>/chaone -s gtalk |
7 | -CHASEN-RC: <%= p('dm.tmp_dir') %>/chasenrc-euc-jp | |
7 | +CHASEN-RC: <%= @runner_tmp_dir %>/chasenrc-euc-jp | |
8 | 8 | |
9 | 9 | # default for numbers and alphabets |
10 | 10 | NUMBER: DECIMAL |
@@ -13,7 +13,7 @@ | ||
13 | 13 | TIME: hms |
14 | 14 | |
15 | 15 | # dictionary |
16 | -DICTIONARY: ./gtalk-eucjp.dic | |
16 | +DICTIONARY: <%= p('ssm.dir') %>/gtalk/gtalk-eucjp.dic | |
17 | 17 | |
18 | 18 | # automatic play of synthesized speech |
19 | 19 | AUTO-PLAY: NO |
@@ -22,43 +22,43 @@ | ||
22 | 22 | AUTO-PLAY-DELAY: 250 |
23 | 23 | |
24 | 24 | # file of phoneme list |
25 | -PHONEME-LIST: mono.lst | |
25 | +PHONEME-LIST: <%= p('ssm.dir') %>/gtalk/mono.lst | |
26 | 26 | |
27 | 27 | # parameter files for each speaker |
28 | 28 | SPEAKER-ID: female01 |
29 | 29 | GENDER: female |
30 | -DUR-TREE-FILE: ../speakers/female01/tree-dur.inf | |
31 | -PIT-TREE-FILE: ../speakers/female01/tree-lf0.inf | |
32 | -MCEP-TREE-FILE: ../speakers/female01/tree-mcep.inf | |
33 | -DUR-MODEL-FILE: ../speakers/female01/duration.pdf | |
34 | -PIT-MODEL-FILE: ../speakers/female01/lf0.pdf | |
35 | -MCEP-MODEL-FILE: ../speakers/female01/mcep.pdf | |
30 | +DUR-TREE-FILE: <%= p('ssm.dir') %>/speakers/female01/tree-dur.inf | |
31 | +PIT-TREE-FILE: <%= p('ssm.dir') %>/speakers/female01/tree-lf0.inf | |
32 | +MCEP-TREE-FILE: <%= p('ssm.dir') %>/speakers/female01/tree-mcep.inf | |
33 | +DUR-MODEL-FILE: <%= p('ssm.dir') %>/speakers/female01/duration.pdf | |
34 | +PIT-MODEL-FILE: <%= p('ssm.dir') %>/speakers/female01/lf0.pdf | |
35 | +MCEP-MODEL-FILE: <%= p('ssm.dir') %>/speakers/female01/mcep.pdf | |
36 | 36 | |
37 | 37 | # parameter files for each speaker |
38 | 38 | SPEAKER-ID: male01 |
39 | 39 | GENDER: male |
40 | -DUR-TREE-FILE: ../speakers/male01/tree-dur.inf | |
41 | -PIT-TREE-FILE: ../speakers/male01/tree-lf0.inf | |
42 | -MCEP-TREE-FILE: ../speakers/male01/tree-mcep.inf | |
43 | -DUR-MODEL-FILE: ../speakers/male01/duration.pdf | |
44 | -PIT-MODEL-FILE: ../speakers/male01/lf0.pdf | |
45 | -MCEP-MODEL-FILE: ../speakers/male01/mcep.pdf | |
40 | +DUR-TREE-FILE: <%= p('ssm.dir') %>/speakers/male01/tree-dur.inf | |
41 | +PIT-TREE-FILE: <%= p('ssm.dir') %>/speakers/male01/tree-lf0.inf | |
42 | +MCEP-TREE-FILE: <%= p('ssm.dir') %>/speakers/male01/tree-mcep.inf | |
43 | +DUR-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male01/duration.pdf | |
44 | +PIT-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male01/lf0.pdf | |
45 | +MCEP-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male01/mcep.pdf | |
46 | 46 | |
47 | 47 | # parameter files for each speaker |
48 | 48 | SPEAKER-ID: male02 |
49 | 49 | GENDER: male |
50 | -DUR-TREE-FILE: ../speakers/male02/tree-dur.inf | |
51 | -PIT-TREE-FILE: ../speakers/male02/tree-lf0.inf | |
52 | -MCEP-TREE-FILE: ../speakers/male02/tree-mcep.inf | |
53 | -DUR-MODEL-FILE: ../speakers/male02/duration.pdf | |
54 | -PIT-MODEL-FILE: ../speakers/male02/lf0.pdf | |
55 | -MCEP-MODEL-FILE: ../speakers/male02/mcep.pdf | |
50 | +DUR-TREE-FILE: <%= p('ssm.dir') %>/speakers/male02/tree-dur.inf | |
51 | +PIT-TREE-FILE: <%= p('ssm.dir') %>/speakers/male02/tree-lf0.inf | |
52 | +MCEP-TREE-FILE: <%= p('ssm.dir') %>/speakers/male02/tree-mcep.inf | |
53 | +DUR-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male02/duration.pdf | |
54 | +PIT-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male02/lf0.pdf | |
55 | +MCEP-MODEL-FILE: <%= p('ssm.dir') %>/speakers/male02/mcep.pdf | |
56 | 56 | |
57 | 57 | SPEAKER-ID: m001 |
58 | 58 | GENDER: male |
59 | -DUR-TREE-FILE: ../speakers/m001/tree-dur.inf | |
60 | -PIT-TREE-FILE: ../speakers/m001/tree-lf0.inf | |
61 | -MCEP-TREE-FILE: ../speakers/m001/tree-mcep.inf | |
62 | -DUR-MODEL-FILE: ../speakers/m001/duration.pdf | |
63 | -PIT-MODEL-FILE: ../speakers/m001/lf0.pdf | |
64 | -MCEP-MODEL-FILE: ../speakers/m001/mcep.pdf | |
59 | +DUR-TREE-FILE: <%= p('ssm.dir') %>/speakers/m001/tree-dur.inf | |
60 | +PIT-TREE-FILE: <%= p('ssm.dir') %>/speakers/m001/tree-lf0.inf | |
61 | +MCEP-TREE-FILE: <%= p('ssm.dir') %>/speakers/m001/tree-mcep.inf | |
62 | +DUR-MODEL-FILE: <%= p('ssm.dir') %>/speakers/m001/duration.pdf | |
63 | +PIT-MODEL-FILE: <%= p('ssm.dir') %>/speakers/m001/lf0.pdf | |
64 | +MCEP-MODEL-FILE: <%= p('ssm.dir') %>/speakers/m001/mcep.pdf |