[update] Julius 実行ファイル及びカスタム辞書を更新。

This commit is contained in:
ocogeclub 2021-11-09 13:32:43 +09:00
parent 481105d508
commit 5b955dd9c9
10 changed files with 6449 additions and 2190 deletions

4
.gitignore vendored
View File

@ -3,8 +3,6 @@ node_modules/
bin/ bin/
build/ build/
*.zip *.zip
push.sh
n
*.bak *.bak
*.old *.old
*.lock

View File

@ -39,7 +39,6 @@ module.exports = {
package: packageTasks.package, package: packageTasks.package,
checkLicenses: licenseTasks.checkLicenses, checkLicenses: licenseTasks.checkLicenses,
recompile: releaseTasks.recompile, recompile: releaseTasks.recompile,
prepareDemos: appengineTasks.prepareDemos,
publish: releaseTasks.publish, publish: releaseTasks.publish,
publishBeta: releaseTasks.publishBeta, publishBeta: releaseTasks.publishBeta,
sortRequires: cleanupTasks.sortRequires, sortRequires: cleanupTasks.sortRequires,

View File

@ -865,14 +865,6 @@
</shadow> </shadow>
</value> </value>
</block> </block>
<block type="ugj_child_openjtalk">
<field name="voice">m001</field>
<value name="talk">
<shadow type="text">
<field name="TEXT">こんにちは!</field>
</shadow>
</value>
</block>
<block type="ugj_child_irrecord"> <block type="ugj_child_irrecord">
<value name="gpio"> <value name="gpio">
<shadow type="math_number"> <shadow type="math_number">

View File

@ -140,7 +140,7 @@ Blockly.Msg["I2C_READ_DEVICE_TOOLTIP"] = "デバイスから指定したバイ
Blockly.Msg["I2C_WRITE_DEVICE_TITLE"] = "i2c デバイスに %1 を送信"; Blockly.Msg["I2C_WRITE_DEVICE_TITLE"] = "i2c デバイスに %1 を送信";
Blockly.Msg["I2C_WRITE_DEVICE_TOOLTIP"] = "i2c デバイスにデータを送信します。"; Blockly.Msg["I2C_WRITE_DEVICE_TOOLTIP"] = "i2c デバイスにデータを送信します。";
Blockly.Msg["UGJ_BME280_TITLE"] = "BME280アドレス %1 の計測値: %2 %3 %4"; Blockly.Msg["UGJ_BME280_TITLE"] = "BME280アドレス %1 から %2 %3 %4 を取得";
Blockly.Msg["UGJ_BME280_TOOLTIP"] = "環境センサーBME280で、気温摂氏、湿度、気圧hPaを計測し、それぞれを変数に代入します。"; Blockly.Msg["UGJ_BME280_TOOLTIP"] = "環境センサーBME280で、気温摂氏、湿度、気圧hPaを計測し、それぞれを変数に代入します。";
Blockly.Msg["UGJ_BME280_READ_TEMP"] = "気温"; Blockly.Msg["UGJ_BME280_READ_TEMP"] = "気温";
Blockly.Msg["UGJ_BME280_READ_HUM"] = "湿度"; Blockly.Msg["UGJ_BME280_READ_HUM"] = "湿度";

View File

@ -4,7 +4,7 @@
// 定数 // 定数
const ugj_const = { const ugj_const = {
doc_root: '/home/pi/Documents/ocoge_docs/', doc_root: process.env["HOME"] + '/Documents',
app_name: 'ocoge', app_name: 'ocoge',
mascot_path: './img/', mascot_path: './img/',
mascot_defname: 'tamachee.png', mascot_defname: 'tamachee.png',
@ -32,6 +32,7 @@ class elUtil {
this.children = []; this.children = [];
this.gpio_backend = ugj_const.pig; this.gpio_backend = ugj_const.pig;
this.i2c_bus = ugj_const.i2c_defbus; this.i2c_bus = ugj_const.i2c_defbus;
this.doc_current = ugj_const.doc_root;
} }
// 0で数値の桁合わせ : NUM=値 LEN=桁数 // 0で数値の桁合わせ : NUM=値 LEN=桁数
zeroPadding(NUM, LEN) { zeroPadding(NUM, LEN) {
@ -41,7 +42,7 @@ class elUtil {
getUniqueFilepath() { getUniqueFilepath() {
let today = new Date(); let today = new Date();
let filename = today.getFullYear() + '-' + this.zeroPadding((today.getMonth() + 1), 2) + '-' + this.zeroPadding(today.getDate(), 2) + '-' + this.zeroPadding(today.getHours(), 2) + '-' + this.zeroPadding(today.getMinutes(), 2) + '-' + this.zeroPadding(today.getSeconds(), 2); let filename = today.getFullYear() + '-' + this.zeroPadding((today.getMonth() + 1), 2) + '-' + this.zeroPadding(today.getDate(), 2) + '-' + this.zeroPadding(today.getHours(), 2) + '-' + this.zeroPadding(today.getMinutes(), 2) + '-' + this.zeroPadding(today.getSeconds(), 2);
let filepath = this.path.join(ugj_const.doc_root, filename); let filepath = this.path.join(this.doc_current, filename);
return filepath; return filepath;
} }
// リンクを外部ブラウザで開く // リンクを外部ブラウザで開く
@ -68,11 +69,12 @@ class elUtil {
newFile() { this.setSaveFilepath(null); } newFile() { this.setSaveFilepath(null); }
// ワークスペースファイル読み込みの一連の動作のラッパ // ワークスペースファイル読み込みの一連の動作のラッパ
async loadWsFile() { async loadWsFile() {
let filepath = await this.openFile('xml', ugj_const.doc_root); let filepath = await this.openFile('xml', this.doc_current);
if (filepath.length > 0) { if (filepath.length > 0) {
if (this.saveFilepath === null) { if (this.saveFilepath === null) {
this.setSaveFilepath(filepath); this.setSaveFilepath(filepath);
} //読み込みに失敗してもsaveFilepathが更新されてしまうのはちょっと具合が悪いかも } //読み込みに失敗してもsaveFilepathが更新されてしまうのはちょっと具合が悪いかも
this.doc_current = this.path.dirname(filepath);
return this.readFromFile(filepath); return this.readFromFile(filepath);
} else { } else {
return ''; return '';
@ -80,8 +82,9 @@ class elUtil {
} }
// その他ファイル読み込みの一連の動作のラッパ // その他ファイル読み込みの一連の動作のラッパ
async loadFile(ext) { async loadFile(ext) {
let filepath = await this.openFile(ext, ugj_const.doc_root); let filepath = await this.openFile(ext, this.doc_current);
if (filepath.length > 0) { if (filepath.length > 0) {
this.doc_current = this.path.dirname(filepath);
return this.readFromFile(filepath); return this.readFromFile(filepath);
} else { } else {
return ''; return '';
@ -169,6 +172,7 @@ class elUtil {
filter = { name: 'text file', extensions: ['txt'] }; filter = { name: 'text file', extensions: ['txt'] };
} }
let filename = await this.ipcRenderer.invoke('save_dialog', title, defName, filter); let filename = await this.ipcRenderer.invoke('save_dialog', title, defName, filter);
this.doc_current = this.path.dirname(filename);
return filename; return filename;
} }
// ファイル書き込み // ファイル書き込み
@ -206,20 +210,26 @@ class elUtil {
savePrefsToLS() { savePrefsToLS() {
let wc = '0'; let wc = '0';
if (this.wsChanged) wc = '1'; if (this.wsChanged) wc = '1';
let o = { 'saveFilepath': this.saveFilepath, 'wsChanged': wc, 'mascotFilePath': this.mascotFilePath }; let o = {
'saveFilepath': this.saveFilepath,
'wsChanged': wc,
'mascotFilePath': this.mascotFilePath,
'doc_current': this.doc_current
};
let s = JSON.stringify(o); let s = JSON.stringify(o);
localStorage.setItem(this.localStorage_fname, s); localStorage.setItem(ugj_const.localStorage_fname, s);
} }
// 設定(保存ファイルパスと未保存フラグ)をローカルストレージからロード // 設定(保存ファイルパスと未保存フラグ)をローカルストレージからロード
loadPrefsFromLS() { loadPrefsFromLS() {
let s = localStorage.getItem(this.localStorage_fname); let s = localStorage.getItem(ugj_const.localStorage_fname);
if (s !== null) { if (s !== null) {
let o = JSON.parse(s); let o = JSON.parse(s);
this.setSaveFilepath(o.saveFilepath); this.setSaveFilepath(o.saveFilepath);
if (o.wsChanged == '0') this.setWsChanged(false); if (o.wsChanged == '0') this.setWsChanged(false);
else this.setWsChanged(true); else this.setWsChanged(true);
if (o.mascotFilePath) this.setMascotFilePath(o.mascotFilePath); if (o.mascotFilePath) this.setMascotFilePath(o.mascotFilePath);
if (o.doc_current) this.doc_current = o.doc_current;
} }
} }

2
lib/beautify.min.js vendored

File diff suppressed because one or more lines are too long

6423
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,8 @@
}, },
"homepage": "https://github.com/ocogeclub/ocoge#readme", "homepage": "https://github.com/ocogeclub/ocoge#readme",
"devDependencies": { "devDependencies": {
"electron": "15.3.0", "electron": "^15.3.0",
"electron-rebuild": "3.2.3" "electron-rebuild": "^3.2.3"
}, },
"dependencies": { "dependencies": {
"@ocogeclub/amg8833": "file:local_modules/@ocogeclub/amg8833", "@ocogeclub/amg8833": "file:local_modules/@ocogeclub/amg8833",
@ -30,9 +30,9 @@
"@tensorflow-models/knn-classifier": "^1.2.2", "@tensorflow-models/knn-classifier": "^1.2.2",
"@tensorflow-models/mobilenet": "^2.1.0", "@tensorflow-models/mobilenet": "^2.1.0",
"@tensorflow/tfjs-node": "^3.11.0", "@tensorflow/tfjs-node": "^3.11.0",
"@vladmandic/face-api": "^1.5.3", "@vladmandic/face-api": "^1.5.7",
"axios": "^0.24.0", "axios": "^0.24.0",
"nodemailer": "^6.6.0", "nodemailer": "^6.7.0",
"tensorset": "^1.2.9" "tensorset": "^1.2.9"
} }
} }

View File

@ -2864,7 +2864,7 @@ Blockly.JavaScript['ugj_spawn'] = function (block) {
var statements_do = Blockly.JavaScript.statementToCode(block, 'do'); var statements_do = Blockly.JavaScript.statementToCode(block, 'do');
var code = [ var code = [
`let child = require('child_process').spawn(${value_childprocess});`, `let child = require('child_process').spawn(${value_childprocess});`,
`elec.addChild(child);`, `elutil.addChild(child);`,
"child.stderr.on('data', data => { console.error(data.toString()) })", "child.stderr.on('data', data => { console.error(data.toString()) })",
"child.stdout.on('data', async data => {", "child.stdout.on('data', async data => {",
`${variable_data} = data.toString();`, `${variable_data} = data.toString();`,
@ -2902,33 +2902,6 @@ Blockly.JavaScript['aquestalk_pi'] = function (block) {
return [code, Blockly.JavaScript.ORDER_NONE]; return [code, Blockly.JavaScript.ORDER_NONE];
}; };
// open jtalk
Blockly.Blocks['ugj_child_openjtalk'] = {
init: function () {
this.appendValueInput("talk")
.setCheck("String");
this.appendDummyInput()
.appendField("とおしゃべりする:声の種類")
.appendField(new Blockly.FieldDropdown([["M001(男性)", "m001"], ["Takumi(男性)", "takumi"], ["Mei(女性)", "mei"], ["f01(女性)", "f01"]]), "voice");
this.setInputsInline(true);
this.setOutput(true, "shcmd");
this.setOutputShape(Blockly.OUTPUT_SHAPE_ROUND);
this.setStyle('special_blocks')
this.setTooltip("日本語音声合成プログラム「openJTalk」を使用してしゃべります。声の種類を選べます。");
this.setHelpUrl("");
}
};
Blockly.JavaScript['ugj_child_openjtalk'] = function (block) {
var value_talk = Blockly.JavaScript.valueToCode(block, 'talk', Blockly.JavaScript.ORDER_ATOMIC);
var dropdown_voice = block.getFieldValue('voice');
// var functionName = Blockly.JavaScript.provideFunction_(
// 'fixText',
// ['const ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ + ' = text => {return text;}']
// );
var code = `'echo ' + ${value_talk} + ' | ${ugj_const.executable_path}open_jtalk/open_jtalk -m ${ugj_const.executable_path}open_jtalk/htsvoices/${dropdown_voice}.htsvoice -x ${ugj_const.executable_path}open_jtalk/open_jtalk_dic_utf_8-1.11 -ow /dev/stdout | aplay --quiet', { shell: true }`;
return [code, Blockly.JavaScript.ORDER_NONE];
};
// fswebcam // fswebcam
Blockly.Blocks['ugj_child_fswebcam'] = { Blockly.Blocks['ugj_child_fswebcam'] = {
init: function () { init: function () {
@ -2965,7 +2938,7 @@ Blockly.Blocks['ugj_child_julius'] = {
} }
}; };
Blockly.JavaScript['ugj_child_julius'] = function (block) { Blockly.JavaScript['ugj_child_julius'] = function (block) {
var code = `'${ugj_const.executable_path}julius/julius-simple', ['-C', '${ugj_const.executable_path}julius/dictation-kit-4.5/assistant.jconf', '-C', '${ugj_const.executable_path}julius/dictation-kit-4.5/am-gmm.jconf', '-quiet']`; var code = `'${ugj_const.executable_path}julius/julius-simple', ['-C', '${ugj_const.executable_path}julius/dictation-kit/am-gmm.jconf', '-gram', '${ugj_const.executable_path}julius/dic/assistant', '-nostrip']`;
return [code, Blockly.JavaScript.ORDER_NONE]; return [code, Blockly.JavaScript.ORDER_NONE];
}; };
// irrp.py - pigpioによる赤外線リモコンの学習 // irrp.py - pigpioによる赤外線リモコンの学習

2136
yarn.lock

File diff suppressed because it is too large Load Diff