Skip to content

Commit

Permalink
Merge commit '6376a606d2b12874f69058c35394e3c5ef203f2b'
Browse files Browse the repository at this point in the history
  • Loading branch information
USED255 committed Aug 13, 2024
2 parents 29a7183 + 6376a60 commit 7f6f6a2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Annotations2Sub/Annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ def __eq__(self, value: object) -> bool:
def Parse(tree: Element) -> List[Annotation]:
"""解析 Annotations 树"""

# 本质上在提取和清理数据

# Annotation 文件是一个 XML 文件
# 详细结构可以看看 src/tests/testCase/annotation.xml.test
# 详细结构可以看看 src/tests/testCase/Baseline/*.xml.test

def ParseAnnotationAlpha(alphaString: str) -> Alpha:
"""
Expand Down
20 changes: 20 additions & 0 deletions src/Annotations2Sub/_Convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ def Convert(
resolutionY: int = 100,
) -> List[Event]:
"""转换 Annotations"""
"""
┌────────────────┐ ┌───────┐
│List[Annotation]│ ┌►│popup()│
└───────┬────────┘ │ └┬┬─────┘
▼ │ ││ ┌────────────┐ ┌─────┐
┌─────────────┐ │ │└►│ popup_box()├─►│Box()├──┐
│Preprocessing│ │ │ └────────────┘ └─────┘ │
└──────┬──────┘ │ │ ┌────────────┐ ┌──────┐ │
▼ │ └─►│popup_text()├─►│Text()├─┤
┌──────────┐ │ └────────────┘ └──────┘ ▼
│Processing├─────┤ ┌───────┐ ┌───────────┐
└──────────┘ ├►│title()│ │List[Event]│
│ └─┬─────┘ └───────────┘
│ │ ┌────────────┐ ▲
│ └►│CenterText()├───────────┤
│ └────────────┘ │
│ ┌────┐ ┌────┐ │
└►│... ├─►│... ├───────────────┘
└────┘ └────┘
"""

def ConvertAnnotation(each: Annotation) -> List[Event]:

Expand Down
6 changes: 3 additions & 3 deletions src/Annotations2Sub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xml.
etree.
┌─────────────────┐ ┌────────┐ ElementTree. ┌─────────┐
│ │ read() │ │ fromstring() │ │ Parse()
│ │ f.read() │ │ fromstring() │ │ Parse()
│ Annotations.xml │ ─────────► │ String │ ───────────────► │ Element │ ────────────┐
│ │ │ │ │ │ │
└─────────────────┘ └────────┘ └─────────┘ │
Expand All @@ -19,8 +19,8 @@
│ │
└──────────────────┘
┌─────────────────┐ ┌────────┐ Sub. ┌─────────────┐ │
│ │ finally │ │ Dump() │ │ Convert() │
┌─────────────────┐ ┌────────┐ ┌─────────────┐ │
│ │ finally │ │ str(Sub) │ │ Convert() │
│ Annotations.ass │ ◄───────── │ String │ ◄───────── │ List[Event] │ ◄─────────────┘
│ │ │ │ │ │
└─────────────────┘ └────────┘ └─────────────┘
Expand Down

0 comments on commit 7f6f6a2

Please sign in to comment.