Comments (3)
This is my Python 3 CSTL extraction script that doesn't use regular expressions. There are no unknows left in terms of CSTL structure.
https://github.com/masagrator/NXGameScripts/blob/main/Cyanotype%20Daydream/CSTL_Extractor_PC.py
Just provide folder with cstl files as argument
f.e.
python CSTL_Extractor_PC.py scenes
from triggerstools.catsystem2.
Maybe you can try notepad++
from triggerstools.catsystem2.
you can easily do this with regular expressions.
this is a python script, which may be helpful.
# 用于粗略提取 CatSystem2 的 .cstl 文件中的翻译内容的脚本
# 输出在与脚本同目录下的 cstl_out.txt 文件中
# Script for rough extraction of translations in the cstl file of Catsystem2
# The output is in cstl_out.txt in the same directory as the script
import re
filename = "com04B.cstl"
f = open(filename, "r", encoding="utf-8", errors="ignore")
fo = open("cstl_out.txt","w", encoding="utf-8")
# 分割旁白的符号
# Symbols used to split narrations
dialogSep = re.compile(r"[\x00][\x00-\xff]")
# 分割对话与角色名的符号,但这可能不起作用
# Symbols used to split dialog and role names, but it may not work
roleSep = re.compile(r"[\x00-\xff]「|「")
unknowChar = re.compile(r"\\x[0-9a-f][0-9a-f]")
while True:
line = f.readline()
if not line:
break
line = re.sub(dialogSep, "\n", line)
line = re.sub(roleSep, " 「", line)
cstlStr = repr(line)
# 替换剩余所有无法识别为文本的二进制为换行符
# Replace any remaining binary unrecognized as text with a line break
cstlStr = re.sub(unknowChar, "\n", cstlStr)
cstlStr = cstlStr.split("\n")
for s1 in cstlStr:
betterStr = s1.split("\\n")
for s2 in betterStr:
# 过滤掉含日文假名的句子,目的是尽可能提取出翻译
# Filter out sentences with Japanese kana
# in order to extract translations whenever possible
if s2 and not re.search("[あ-んア-ン]", s2):
fo.write('"{}"\n\n'.format(s2))
fo.close()
from triggerstools.catsystem2.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from triggerstools.catsystem2.