semvec/pypi-packages huggingface dataset:
funnylog 2024.5.24
PaddleOCR-RPC
Requires Python: >=3.6

# FunnyLog

一个简单易用、功能强大的日志工具。

只需要加一个装饰器，就能自动日志输出类里面所有的方法的功能说明。

---

**Documentation**: <a href="https://linuxdeepin.github.io/funnylog" target="_blank">https://linuxdeepin.github.io/funnylog</a>

**Source Code**: <a href="https://github.com/linuxdeepin/funnylog" target="_blank">https://github.com/linuxdeepin/funnylog</a>

---

## 安装

```console
pip install funnylog
```

## 使用说明

```python
from funnylog import logger
from funnylog import log
from funnylog.conf import setting

setting.CLASS_NAME_ENDSWITH = ("Log",)
logger("DEBUG")


class BaseLog:

    def base_self_method(self):
        """我是 基类 里面的实例方法"""

    @classmethod
    def base_cls_method(self):
        """我是 基类 里面的类方法"""

    @staticmethod
    def base_static_method():
        """我是 基类 里面的静态方法"""

# 注意这里，只需要在这里挂一个装饰器
@log
class TestLog(BaseLog):
    """继承了基类BaseLog"""

    def self_method(self):
        """我是 类 里面的实例方法"""

    @classmethod
    def cls_method(self):
        """我是 类 里面的类方法"""

    @staticmethod
    def static_method():
        """我是 类 里面的静态方法"""


if __name__ == '__main__':
    # @log装饰器自动打印
    TestLog().self_method()
    TestLog().cls_method()
    TestLog().static_method()
    # 直接调用基类里面的方法，也能自动打印
    TestLog().base_self_method()
    TestLog().base_cls_method()
    TestLog().base_static_method()
```

终端输出效果：

<center>    <img style="border-radius: 0.3125em;    box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.08);"     src="./docs/img/log.png">    <br>    <div style="color:orange; border-bottom: 1px solid #d9d9d9;    display: inline-block;    color: #999;    padding: 2px;"></div> </center>
cacoepy 1.1.0
A small collection of tools related to mispronunciation detection and diagnosis (MDD) systems.
Requires Python: >=3.10

# cacoepy
cacoepy is a small collection of tools related to mispronunciation detection and diagnosis (MDD) systems.

___

## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install cacopey.

```bash
pip install cacoepy
```


## Usage
### AlignARPAbet2
The `AlignARPAbet2` class is used to align two sequences of ARPAbet phonemes, taking into account phoneme similarities. Typically sequence aligners focus on identifying matches and mismatches. However, for a more realistic alignment of phonemes in mispronounced speech versus the intended phonemes, it is important to consider the similarity between phoneme pairs.
<br>
When creating the instance, specify a gap penalty. A more negative value discourages the insertion of gaps.
```python
from cacoepy.aligner import AlignARPAbet2
from cacoepy.core.utils import pretty_sequences

aligner = AlignARPAbet2(gap_penalty=-4)
target_phonemes = "th er m aa m ah t er".split(" ")
mispronounced_phonemes = "uw ao m eh d er".split(" ")

aligned_mispronounced, aligned_target, score = aligner(mispronounced_phonemes, target_phonemes)
pretty_sequences(aligned_target, aligned_mispronounced)
```

**Output**:
```bash
th  er  m  aa  m  ah  t  er
-   uw  -  ao  m  eh  d  er
```
In this example, many of the phonemes are substituted or deleted in this child’s transcription of “thermometer.” Despite this, the `AlignARPAbet2` has found a good alignment by factoring in the similarities between pairs such as *er* and *uw*. For comparison, the Python package `Levenshtein editops` alignment of the same sequences was:

```
th  er  m  aa  m  ah  t  er
uw  ao  m  eh  d  -   -  er
```
Where it only aligns based on exact matches. Further implementation details can be found [here](docs/similarity_matrix.md).

### align_prediction_to_annotation_and_target
Given three sets of phoneme sequences:
- `target`: The phonemes the speaker is attempting to say.
- `annotation`: The annotation of how the speaker pronounced the target.
- `prediction`: The output of an MDD system predicting what the speaker said.
<br>
This function aligns the prediction sequence to the annotation sequence while preserving the existing alignment between annotation and target.

```python
from cacoepy.aligner import align_prediction_to_annotation_and_target
from cacoepy.core.utils import pretty_sequences

target = "th er m aa m ah t er".split(" ")
annotation = "- uw - ao m eh d er".split(" ")
prediction = "uw aa ao m eh d uh er".split(" ")

aligned_pred, aligned_ann, aligned_tar = align_prediction_to_annotation_and_target(
    target_aligned_with_annotation=target,
    annotation_aligned_with_target=annotation,
    prediction=prediction,
)
pretty_sequences(aligned_tar, aligned_ann, aligned_pred)
```
**Output**
```bash
th  er  m   aa  m  ah  t  -   er
-   uw  -   ao  m  eh  d  -   er
-   uw  aa  ao  m  eh  d  uh  er
```

## Future Features
- `AlignARPAbet3` - Aligns 3 sets of phonemes.
- `mdd_phoneme_metrics` - Evaluation metrics for MDD systems.




## License

[MIT](https://choosealicense.com/licenses/mit/)