2 Star 17 Fork 4

wubi98/rimetool

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
薄荷解析模版.config 6.38 KB
一键复制 编辑 原始数据 按行查看 历史
wubi98 提交于 2024-06-27 12:27 . update 薄荷解析模版.config.
Component.onCompleted: {
if(!testSchemeModel()){
console.log("进入兼容报错窗口!")
loader.sourceComponent = anErroWindow
loader.item;
}else{
reBuildDB.checked = SettingsHelper.getBoolFromYaml("controlBehaviorOnScreen","reBuildDB")
reLoadPage();
}
}
function testSchemeModel(){
//先访问,发现错误,再插入
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_user_dict:", false);
let test1= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_user_dict :"+test1)
if(test1.trim().length === 0){
console.log("添加: translator>enable_user_dict")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_user_dict: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_sentence:", false);
let test2= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_sentence :"+test2)
if(test2.trim().length === 0){
console.log("添加: translator>enable_sentence")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_sentence: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_completion:", false);
let test3= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_completion :"+test3)
if(test3.trim().length === 0){
console.log("添加: translator>enable_completion")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_completion: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," enable_encoder:", false);
let test4= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>enable_encoder :"+test4)
if(test4.trim().length === 0){
console.log("添加: translator>enable_encoder")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," enable_encoder: false")
}
myUniversalYamlTool.vistAnyNodeForTest("engine:","translator:"," encode_commit_history:", false);
let test5= myUniversalYamlTool.getCurrentTargetLine();
console.log("检测 translator>encode_commit_history :"+test5)
if(test5.trim().length === 0){
console.log("添加: translator>encode_commit_history")
myUniversalYamlTool.appendAnyLineToCurrentList("schema","switches:","translator:"," encode_commit_history: false")
}
//防止模版错误
const ok1 = myUniversalYamlTool.testExistItem(" - name: transcription※ - name: emoji")
const ok2 = myUniversalYamlTool.testExistItem("menu:※ page_size:")
const ok3 = myUniversalYamlTool.testExistItem("melt_eng:※ - name: ascii_punct")
console.log("打印【薄荷】兼容性测试结果:"+ ok1 +","+ ok2 +","+ ok3)
return ok1 && ok2 && ok3
}
function reLoadPage(){
if(myUniversalYamlTool.testExistItem("accept: Return※send: Escape")){
// console.log("经验测,Return有值!")
cleanCodeByEnter.checked = true;
}else{
// console.log("经验测,Return无值!")
cleanCodeByEnter.checked = false
}
if(myUniversalYamlTool.testExistItem("accept: semicolon※send: 2")){
// console.log("经验测,Return有值!")
selectBysemicolon.checked = true;
}else{
// console.log("经验测,Return无值!")
selectBysemicolon.checked = false
}
myUniversalYamlTool.vistAnyNode("switches:"," - name: transcription"," reset:", true);
useTradition.checked = myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:", " - name: ascii_mode", " reset:", true);
useAscii.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: emoji"," reset:", true);
showEmoji.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: ascii_punct"," reset:", true);
useENGPunc.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:"," - name: full_shape"," reset:", true);
showFull_shape.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_user_dict:", true);
useAutoFre.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_sentence:", true);
useAutoPhrase.checked= myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("engine:","translator:"," enable_completion:", true);
useNextTips.checked = myUniversalYamlTool.getCurrentListBool();
myUniversalYamlTool.vistAnyNode("switches:","menu:"," page_size:", true);
candidatesCount.value = myUniversalYamlTool.getCurrentListInt();
if(candidatesCount.value>9){//大于9,是非法的
candidatesCount.value = 9
}
else if(candidatesCount.value<=2){
candidatesCount.value = 2
}
console.log("捕获的 candidatesCount.value 是:"+candidatesCount.value)
getMainDictForCurrentSchemaID()
}
function getMainDictForCurrentSchemaID(){
myUniversalYamlTool.vistAnyNode("schema:","translator:"," dictionary:", true);
let nameFirst = myUniversalYamlTool.getCurrentListStr();
console.log("当前主翻译器的词典名称:"+nameFirst)
let nameSec = userDictRoot + "/"+ nameFirst + ".dict.yaml"
console.log("当前主词库名称:"+nameSec)
let nameLast = myUniversalYamlTool.vistAnyNodeByAnyYaml(nameSec,"name:", "import_tables:"," - dicts/", false)
nameLast = nameLast.replace(/\s*-\s*/, "");
console.log("捕获的是:"+ nameLast + ".dict.yaml")
let setStr = nameLast
setStr = setStr.replace(/[\/.]/g, '')
dBNameForCurrent = setStr
controlBehaviorOnScreen.currentMainDictFirst= nameLast + ".dict.yaml"
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wubi98/rimetool.git
git@gitee.com:wubi98/rimetool.git
wubi98
rimetool
rimetool
master

搜索帮助