# Pysinsy
[![PyPI](https://img.shields.io/pypi/v/pysinsy.svg)](https://pypi.python.org/pypi/pysinsy)
![Python package](https://github.com/r9y9/pysinsy/workflows/Python%20package/badge.svg)
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md)
[![][docs-latest-img]][docs-latest-url]
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
[docs-latest-url]: https://r9y9.github.io/pysinsy/
A python wrapper for https://github.com/r9y9/sinsy.
Please notice that the package is in an alpha state. APIs will subject to change.
## Notice
The package is built with the [modified version of sinsy](https://github.com/r9y9/sinsy). The modified version provides the same functionality with some improvements (e.g., cmake support) but is technically different from the one from HTS working group.
## Build requirements
The python package relies on cython to make python bindings for sinsy. You must need the following tools to build and install pysinsy:
- C/C++ compilers (to build C/C++ extentions)
- cython
## Supported platforms
- Linux
- Mac OSX
- Windows (MSVC)
## Installation
```
pip install pysinsy
```
## Development
To build the package locally, you will need to make sure to clone sinsy.
```
git submodule update --recursive --init
```
and then run
```
pip install -e .
```
## Quick demo
```py
import pysinsy
sinsy = pysinsy.Sinsy()
# Set language to Japanese
assert sinsy.setLanguages("j", pysinsy.get_default_dic_dir())
assert sinsy.loadScoreFromMusicXML("./tests/song070_f00001_063.xml")
print("Mono labels:")
is_mono = True
labels = sinsy.createLabelData(is_mono, 1, 1).getData()
for l in labels[:5]:
print(l)
print("\nFull-context labels:")
is_mono = False
labels = sinsy.createLabelData(is_mono, 1, 1).getData()
for l in labels[:5]:
print(l)
sinsy.clearScore()
```
Output:
```
Mono labels:
0 10909090 sil
10909090 21818181 sil
21818181 32727272 sil
32727272 43636363 pau
43636363 47727272 g
Full-context labels:
0 10909090 s@xx^xx-sil+sil=sil_xx%xx^00_00~00-1!1[xx$xx]xx/A:xx-xx-xx@xx~xx/B:1_1_1@xx|xx/C:2+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:xx]xx^0=2/4~110!1@109#48+xx]1$1|0[10&0]48=0^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=0^100~xx#xx_xx;xx$xx&xx%xx[xx|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+xx!xx^xx/F:A4#9#0-2/4$110$1+40%18;xx/G:xx_xx/H:xx_xx/I:12_12/J:2~2@3
43636363 47727272 c@sil^pau-g+e=N_00%00^00_00~00-1!2[xx$1]xx/A:xx-xx-xx@xx~xx/B:2_1_1@JPN|0/C:1+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:A4]9^0=2/4~110!1@40#18+xx]1$4|0[10&0]48=0^100~1#12_0;38$0&168%0[100|0]0-n^xx+xx~xx=xx@xx$xx!2%xx#5|xx|24-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+p0!xx^xx/F:A4#9#0-2/4$110$1+13%6;xx/G:xx_xx/H:12_12/I:11_11/J:2~2@3
```
Raw data
{
"_id": null,
"home_page": "https://github.com/r9y9/pysinsy",
"name": "pysinsy",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Sinsy,Research",
"author": "Ryuichi Yamamoto",
"author_email": "zryuichi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ef/f8/81ec9a17786e696bda9369d10bade4de9e949931a6b9e81cbf25097ffc4e/pysinsy-0.0.5.tar.gz",
"platform": null,
"description": "# Pysinsy\n\n[![PyPI](https://img.shields.io/pypi/v/pysinsy.svg)](https://pypi.python.org/pypi/pysinsy)\n![Python package](https://github.com/r9y9/pysinsy/workflows/Python%20package/badge.svg)\n[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE.md)\n[![][docs-latest-img]][docs-latest-url]\n\n\n[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg\n[docs-latest-url]: https://r9y9.github.io/pysinsy/\n\n\nA python wrapper for https://github.com/r9y9/sinsy.\n\nPlease notice that the package is in an alpha state. APIs will subject to change.\n\n## Notice\n\nThe package is built with the [modified version of sinsy](https://github.com/r9y9/sinsy). The modified version provides the same functionality with some improvements (e.g., cmake support) but is technically different from the one from HTS working group.\n\n## Build requirements\n\nThe python package relies on cython to make python bindings for sinsy. You must need the following tools to build and install pysinsy:\n\n- C/C++ compilers (to build C/C++ extentions)\n- cython\n\n## Supported platforms\n\n- Linux\n- Mac OSX\n- Windows (MSVC)\n\n## Installation\n\n```\npip install pysinsy\n```\n\n## Development\n\nTo build the package locally, you will need to make sure to clone sinsy.\n\n```\ngit submodule update --recursive --init\n```\n\nand then run\n\n```\npip install -e .\n```\n\n## Quick demo\n\n```py\nimport pysinsy\n\nsinsy = pysinsy.Sinsy()\n\n# Set language to Japanese\nassert sinsy.setLanguages(\"j\", pysinsy.get_default_dic_dir())\nassert sinsy.loadScoreFromMusicXML(\"./tests/song070_f00001_063.xml\")\n\nprint(\"Mono labels:\")\nis_mono = True\nlabels = sinsy.createLabelData(is_mono, 1, 1).getData()\nfor l in labels[:5]:\n print(l)\n\nprint(\"\\nFull-context labels:\")\nis_mono = False\nlabels = sinsy.createLabelData(is_mono, 1, 1).getData()\nfor l in labels[:5]:\n print(l)\n\nsinsy.clearScore()\n```\n\nOutput:\n\n```\nMono labels:\n0 10909090 sil\n10909090 21818181 sil\n21818181 32727272 sil\n32727272 43636363 pau\n43636363 47727272 g\n\nFull-context labels:\n0 10909090 s@xx^xx-sil+sil=sil_xx%xx^00_00~00-1!1[xx$xx]xx/A:xx-xx-xx@xx~xx/B:1_1_1@xx|xx/C:2+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:xx]xx^0=2/4~110!1@109#48+xx]1$1|0[10&0]48=0^100~xx#xx_xx;xx$xx&xx%xx[xx|0]0-n^xx+xx~xx=xx@xx$xx!xx%xx#xx|xx|xx-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+xx!xx^xx/F:A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xx/F:A4#9#0-2/4$110$1+40%18;xx/G:xx_xx/H:xx_xx/I:12_12/J:2~2@3\n43636363 47727272 c@sil^pau-g+e=N_00%00^00_00~00-1!2[xx$1]xx/A:xx-xx-xx@xx~xx/B:2_1_1@JPN|0/C:1+1+1@JPN&0/D:xx!xx#xx$xx%xx|xx&xx;xx-xx/E:A4]9^0=2/4~110!1@40#18+xx]1$4|0[10&0]48=0^100~1#12_0;38$0&168%0[100|0]0-n^xx+xx~xx=xx@xx$xx!2%xx#5|xx|24-xx&xx&xx+xx[xx;xx]xx;xx~xx~xx^xx^xx@xx[xx#xx=xx!xx~xx+p0!xx^xx/F:A4#9#0-2/4$110$1+13%6;xx/G:xx_xx/H:12_12/I:11_11/J:2~2@3\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A python wrapper for sinsy",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/r9y9/pysinsy"
},
"split_keywords": [
"sinsy",
"research"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eff881ec9a17786e696bda9369d10bade4de9e949931a6b9e81cbf25097ffc4e",
"md5": "3cf07262c418f8ada7e23a0b26017548",
"sha256": "aea0254f73e45c2dfad4fbf146d852e6fe1c24ae5fe2004ae1cf220db50ebd78"
},
"downloads": -1,
"filename": "pysinsy-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "3cf07262c418f8ada7e23a0b26017548",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1373421,
"upload_time": "2023-10-09T03:04:19",
"upload_time_iso_8601": "2023-10-09T03:04:19.106110Z",
"url": "https://files.pythonhosted.org/packages/ef/f8/81ec9a17786e696bda9369d10bade4de9e949931a6b9e81cbf25097ffc4e/pysinsy-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-09 03:04:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "r9y9",
"github_project": "pysinsy",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "pysinsy"
}