re.error: bad character range 庄-宏 at position 1238

在运行自定义的Deep Text Recognition模型时遇到字典错误,提示're.error:badcharacterrange庄-宏atposition1238'。问题源于Python正则表达式中分隔符集的排序。解决方案是将特殊字符'-'移至字典的第一个字符之后,确保分隔符集合按ASCII值升序排列。按照这个修改后,问题得到解决。

跑一个自己魔改的deep-text-recognition-benchmark时,字典报错

re.error: bad character range 庄-宏 at position 1238

网上看了看,有这么一个解释“python 分割中文句子的时候报错:re分割字符串时,所用的分隔符集合必须按其ASCII值的大小从小到大排列”,把‘-’放到字典的第一个字符后问题解决。

Reference

【python】re.error: bad character range

CCEffect %{ techniques: - passes: - vert: vs frag: fs properties: &props mainTexture: { value: 'white' } // 修改为mainTexture outlineColor: { value: [1,0,0,1], editor: { type: 'color' } } outlineWidth: { value: 0.02, editor: { type: 'slider', min: 0, max: 0.1 } } }% CCProgram vs %{ precision highp float; #include <cc-global> #include <cc-local> in vec3 a_position; in vec2 a_texCoord; in vec4 a_color; out vec4 v_color; out vec2 v_uv0; void main() { vec4 pos = vec4(a_position, 1.0); pos = cc_matWorld * pos; gl_Position = cc_matProj * cc_matView * pos; v_uv0 = a_texCoord; v_color = a_color; } }% CCProgram fs %{ precision highp float; uniform sampler2D mainTexture; // 修改为mainTexture uniform Constant { vec4 outlineColor; float outlineWidth; }; in vec4 v_color; in vec2 v_uv0; void main() { vec4 texColor = texture2D(mainTexture, v_uv0); // 修改为mainTexture float alpha = texColor.a * v_color.a; // 边缘检测 float maxAlpha = 0.0; for(int x = -1; x <= 1; ++x) { for(int y = -1; y <= 1; ++y) { vec2 offset = vec2(x,y) * outlineWidth; maxAlpha = max(maxAlpha, texture2D(mainTexture, v_uv0 + offset).a); // 修改为mainTexture } } // 颜色混合 vec4 finalColor = mix(outlineColor, v_color * texColor, alpha); finalColor.a = max(outlineColor.a * (maxAlpha - alpha), alpha); gl_FragColor = finalColor; } }% 以上在cocoscreator3.8.2中创建的spine描边.effect报错 1. [Assets] ../bundle/gui/shaders/spine-outline.effect - syntax: Error EFX1001: CCEffect parser failed: YAMLException: bad indentation of a mapping entry (7:43) 4 | ... t: vs 5 | ... g: fs 6 | ... perties: &props 7 | ... ainTexture: { value: 'white' } // 修改为mainTexture -----------------------------------------^ 8 | ... utlineColor: { value: [1,0,0,1], editor: { type: 'color' } } 9 | ... utlineWidth: { value: 0.02, editor: { type: 'slider', min: 0, m ... [Assets] ../bundle/gui/shaders/spine-outline.effect - syntax: Error EFX1001: CCEffect parser failed: YAMLException: bad indentation of a mapping entry (7:43) -----------------------------------------^ -----------------------------------------^ at Object.encode (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\node_modules\@base\electron-worker\node_modules\v-stacks\index.js:14:17) at Logger._logHandler (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\node_modules\@base\electron-worker\static\script.ccc:1:531) at Logger.record (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\node_modules\@base\electron-logger\lib\renderer.ccc:1:458) at Object.error (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\node_modules\@base\electron-logger\lib\renderer.ccc:1:1414) at Object.error (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\builtin\asset-db\dist\worker\console.ccc:1:1429) at EffectImporter.import (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\modules\engine-extensions\extensions\engine-extends\dist\importer\importers\effect.ccc:1:3086) at runMicrotasks (<anonymous>) at runNextTicks (internal/process/task_queues.js:58:5) at processImmediate (internal/timers.js:434:9) 2. [Window] The "path" argument must be of type string or an instance of Buffer or URL. Received undefined TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined at Object.openSync (fs.js:468:10) at Object.func [as openSync] (electron/js2c/asar_bundle.js:5:1846) at readFileSync (fs.js:377:35) at e.readFileSync (electron/js2c/asar_bundle.js:5:8872) at Object.refresh (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\resources\3d\engine\editor\inspector\assets\effect.js:313:39) at Object.<anonymous> (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\resources\3d\engine\editor\inspector\assets\effect.js:415:26) at HTMLElement.update (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\app.asar\node_modules\@editor\creator-ui-kit\dist\renderer.ccc:2:1642565) at C:\ProgramData\cocos\editors\Creator\3.8.2\resources\resources\3d\engine\editor\inspector\contributions\asset.js:358:43 at Array.map (<anonymous>) at Object.update (C:\ProgramData\cocos\editors\Creator\3.8.2\resources\resources\3d\engine\editor\inspector\contributions\asset.js:357:50)
05-28
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值