Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ayaka14732 committed Apr 18, 2024
1 parent 63ccd3d commit 0fa92a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/QieyunEncoder/變換/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from .母到組 import 母到組
from .母到音 import 母到音
from .韻到攝 import 韻到攝
from .母與等到類 import 母與等到類
18 changes: 11 additions & 7 deletions src/QieyunEncoder/音韻地位.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re

from . import 常量
from .變換 import 母到清濁, 母到音, 母到組, 韻到攝
from .變換 import 母到清濁, 母到音, 母到組, 韻到攝, 母與等到類

編碼表 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
韻順序表 = '東_冬鍾江支脂之微魚虞模齊祭泰佳皆夬灰咍廢真臻文殷元魂痕寒刪山仙先蕭宵肴豪歌_麻_陽唐庚_耕清青蒸登尤侯幽侵覃談鹽添咸銜嚴凡'
Expand Down Expand Up @@ -146,11 +146,13 @@ def 最簡描述(self) -> str:
= self.

if not in 常量.開合兼備的韻:
= None
= ''
if not in 常量.一三等韻 and not in 常量.二三等韻:
= None
= ''
if 重紐 is None:
重紐 = ''

return + ( or '') + ( or '') + (重紐 or '') + +
return f'{}{}{}{重紐}{}{}'

@property
def 表達式(self) -> str:
Expand Down Expand Up @@ -198,7 +200,7 @@ def 最簡表達式(self) -> str:
if not in 常量.開合兼備的韻:
= None
if not in 常量.一三等韻 and not in 常量.二三等韻:
= None
= ''

呼字段 = f'{}口 ' if else ''
等字段 = f'{}等 ' if else ''
Expand Down Expand Up @@ -403,8 +405,8 @@ def from編碼(編碼: str):
聲編碼 = 其他編碼 & 0b11

= 常量.所有母[母編碼]
= 常量.所有呼[呼編碼]
重紐 = 常量.所有重紐[重紐編碼]
: str | None = 常量.所有呼[呼編碼]
重紐: str | None = 常量.所有重紐[重紐編碼]
= 常量.所有聲[聲編碼]

if 韻編碼 == 0:
Expand Down Expand Up @@ -483,6 +485,8 @@ def from描述(描述: str):
= '三'
elif in 常量.四等韻:
= '四'
else:
raise ValueError(f'Unexpected 韻: {}')

音韻地位.驗證(, , , 重紐, , )

Expand Down

0 comments on commit 0fa92a7

Please sign in to comment.