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 094f76b commit 63ccd3d
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 64 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Qieyun Encoder Python 說明文件
:maxdepth: 1

常量
變換
音韻地位
工具

Expand Down
8 changes: 8 additions & 0 deletions docs/變換.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
QieyunEncoder.變換
==================

.. automodule:: QieyunEncoder.變換
:imported-members:
:members:
:undoc-members:
:show-inheritance:
9 changes: 0 additions & 9 deletions src/QieyunEncoder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,5 @@
from . import 常量
from .音韻地位 import 音韻地位
from .韻鏡位置 import 韻鏡位置
from .工具.反切 import 反切
from .工具.韻目到韻 import 韻目到韻
from .工具.母到清濁 import 母到清濁
from .工具.母到組 import 母到組
from .工具.母到音 import 母到音
from .工具.韻到攝 import 韻到攝
from .工具.音韻地位到韻鏡位置 import 音韻地位到韻鏡位置
from .工具.韻鏡位置到音韻地位 import 韻鏡位置到音韻地位
from .工具.音韻屬性到韻鏡位置們 import 音韻屬性到韻鏡位置們

__version__ = '0.4.3'
5 changes: 5 additions & 0 deletions src/QieyunEncoder/工具/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# -*- coding: utf-8 -*-

from .反切 import 反切
from .音韻地位到韻鏡位置 import 音韻地位到韻鏡位置
from .韻鏡位置到音韻地位 import 韻鏡位置到音韻地位
from .音韻屬性到韻鏡位置們 import 音韻屬性到韻鏡位置們
6 changes: 3 additions & 3 deletions src/QieyunEncoder/工具/音韻屬性到韻鏡位置們.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
'''

from ..韻鏡位置 import 韻鏡位置
from ..常量 import 常量
from .韻目到韻 import 韻目到韻
from .母到組 import 母到組
from .. import 常量
from ..變換 import 韻目到韻
from ..變換 import 母到組


def 音韻屬性到韻鏡位置們(: str, 韻目: str, : str):
Expand Down
2 changes: 1 addition & 1 deletion src/QieyunEncoder/工具/韻鏡位置到音韻地位.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ..音韻地位 import 音韻地位
from ..韻鏡位置 import 韻鏡位置
from ..常量 import 常量
from .. import 常量


def 韻鏡位置到音韻地位(當前韻鏡位置: 韻鏡位置) -> 音韻地位:
Expand Down
7 changes: 7 additions & 0 deletions src/QieyunEncoder/變換/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-

from .韻目到韻 import 韻目到韻
from .母到清濁 import 母到清濁
from .母到組 import 母到組
from .母到音 import 母到音
from .韻到攝 import 韻到攝
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@

_d母到清濁 = {: 清濁 for 清濁, 母們 in _清濁到母表 for in 母們}


def 母到清濁(: str):
def 母到清濁(: str) -> str:
'''
將母轉換爲清濁。
```python
>>> 母到清濁('端')
'全清'
>>> 母到清濁('以')
'次濁'
```
Examples:
>>> 母到清濁('端')
'全清'
>>> 母到清濁('以')
'次濁'
'''
return _d母到清濁[]
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@

_d母到組 = {: for , 母們 in _組到母表 for in 母們}


def 母到組(: str):
def 母到組(: str) -> str | None:
'''
將母轉換爲組。
```python
>>> 母到組('滂')
'幫'
>>> 母到組('云')
'影'
>>> 母到組('以')
None
```
Examples:
>>> 母到組('滂')
'幫'
>>> 母到組('云')
'影'
>>> 母到組('以')
None
'''
return _d母到組[]
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@

_d母到音 = {: for , 母們 in _音到母表 for in 母們}


def 母到音(: str):
def 母到音(: str) -> str:
'''
將母轉換爲音。
```python
>>> 母到音('並')
'脣'
>>> 母到音('羣')
'牙'
```
Examples:
>>> 母到音('並')
'脣'
>>> 母到音('羣')
'牙'
'''
return _d母到音[]
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
('而', '日', None),
)


def 母與等到類(: str, : str) -> str:
for 聲類, 母條件, 等條件 in _五十一聲類映射表:
if == 母條件 and (等條件 is None or in 等條件):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@

_d韻到攝 = {: for , 韻們 in _攝到韻表 for in 韻們}


def 韻到攝(: str):
def 韻到攝(: str) -> str:
'''
將韻轉換爲攝。
Examples:
```python
>>> 韻到攝('冬')
'通'
>>> 韻到攝('侵')
'深'
```
>>> 韻到攝('冬')
'通'
>>> 韻到攝('侵')
'深'
'''
return _d韻到攝[]
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,21 @@
'夬𡗒',
)

_標準韻映射表 = {非標準韻: 非標準韻們[0]
for 非標準韻們 in _非標準韻表 for 非標準韻 in 非標準韻們.replace(' ', '')}
_標準韻映射表 = {非標準韻: 非標準韻們[0] for 非標準韻們 in _非標準韻表 for 非標準韻 in 非標準韻們.replace(' ', '')}


def 韻目到韻(: str):
def 韻目到韻(: str) -> str:
'''
將切韻系韻書的韻目轉換爲韻。
```python
>>> 韻目到韻('物')
'文'
>>> 韻目到韻('敬')
'庚'
>>> 韻目到韻('東')
'東'
```
此函式具有冪等性,即 ``韻目到韻(韻目到韻(韻目)) == 韻目到韻(韻目)`` 永遠成立。
此函式具有冪等性,即 `韻目到韻(韻目到韻(韻目)) == 韻目到韻(韻目)` 永遠成立。
Examples:
>>> 韻目到韻('物')
'文'
>>> 韻目到韻('敬')
'庚'
>>> 韻目到韻('東')
'東'
'''
return _標準韻映射表[]
2 changes: 1 addition & 1 deletion 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
4 changes: 2 additions & 2 deletions src/QieyunEncoder/韻鏡位置.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import re
from typing import Optional, Union

from .工具.韻目到韻 import 韻目到韻
from .常量 import 常量
from .變換 import 韻目到韻
from . import 常量

_韻鏡母位置表 = [
'脣音第一位', '脣音第二位', '脣音第三位', '脣音第四位',
Expand Down

0 comments on commit 63ccd3d

Please sign in to comment.