# fast-scores
[][](https://img.shields.io/static/v1?label=python+&message=3.7%2B&color=blue)[](https://github.com/psf/black)[](https://opensource.org/licenses/MIT)[](https://badge.fury.io/py/fast_scores)
Calculate correlatioin matrix fast
## Preinstall fasttext
```
pip install fasttext
```
For Windows without a C/C++ compiler:
* Download a proper whl (e.g., `fasttext‑0.9.2‑cp36‑cp36m‑win_amd64.whl` for 64bits Python 3.6 etc) from [https://www.lfd.uci.edu/~gohlke/pythonlibs/#fasttext](https://www.lfd.uci.edu/~gohlke/pythonlibs/#fasttext)
```bash
pip install fasttext*.whl
```
or (for python 3.8)
```
pip install https://github.com/ffreemt/ezbee/raw/main/data/artifects/fasttext-0.9.2-cp38-cp38-win_amd64.whl
```
## Installation
```
pip install fast-scores
```
## Usage
```shell
# from fast-scores\tests\test_gen_cmat.py
from fast_scores.gen_cmat import gen_cmat
text_en = "test this\nbla bla\n love"
text_zh = "测试\n 爱\n吃了吗\n你好啊"
list1 = [elm.strip() for elm in text_en.splitlines() if elm.strip()]
list2 = [elm.strip() for elm in text_zh.splitlines() if elm.strip()]
cmat = gen_cmat(list1, list2) # len(list2) x len(list1)
print(cmat)
# [[0.75273851 0. 0. ]
# [0. 0. 0.86848247]
# [0. 0. 0. ]
# [0. 0. 0. ]]
len_y, len_x = cmat.shape
assert cmat.max() > 0.86 # 0.868
_ = divmod(cmat.argmax(), len_x)
assert cmat[_] == cmat.max()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ffreemt/fast-scores",
"name": "fast-scores",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "freemt",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/dd/f9/c5ca7d03bfaa379ec975b49060848d489d7070d3b25fbe9574135899c883/fast_scores-0.1.4.tar.gz",
"platform": null,
"description": "# fast-scores\n[][](https://img.shields.io/static/v1?label=python+&message=3.7%2B&color=blue)[](https://github.com/psf/black)[](https://opensource.org/licenses/MIT)[](https://badge.fury.io/py/fast_scores)\n\nCalculate correlatioin matrix fast\n\n## Preinstall fasttext\n\n```\npip install fasttext\n```\n\nFor Windows without a C/C++ compiler:\n* Download a proper whl (e.g., `fasttext\u20110.9.2\u2011cp36\u2011cp36m\u2011win_amd64.whl` for 64bits Python 3.6 etc) from [https://www.lfd.uci.edu/~gohlke/pythonlibs/#fasttext](https://www.lfd.uci.edu/~gohlke/pythonlibs/#fasttext)\n```bash\npip install fasttext*.whl\n```\nor (for python 3.8)\n```\npip install https://github.com/ffreemt/ezbee/raw/main/data/artifects/fasttext-0.9.2-cp38-cp38-win_amd64.whl\n```\n## Installation\n```\npip install fast-scores\n```\n\n## Usage\n\n```shell\n# from fast-scores\\tests\\test_gen_cmat.py\n\nfrom fast_scores.gen_cmat import gen_cmat\n\ntext_en = \"test this\\nbla bla\\n love\"\ntext_zh = \"\u6d4b\u8bd5\\n \u7231\\n\u5403\u4e86\u5417\\n\u4f60\u597d\u554a\"\n\nlist1 = [elm.strip() for elm in text_en.splitlines() if elm.strip()]\nlist2 = [elm.strip() for elm in text_zh.splitlines() if elm.strip()]\n\ncmat = gen_cmat(list1, list2) # len(list2) x len(list1)\nprint(cmat)\n# [[0.75273851 0. 0. ]\n# [0. 0. 0.86848247]\n# [0. 0. 0. ]\n# [0. 0. 0. ]]\n\nlen_y, len_x = cmat.shape\n\nassert cmat.max() > 0.86 # 0.868\n_ = divmod(cmat.argmax(), len_x)\nassert cmat[_] == cmat.max()\n\n```",
"bugtrack_url": null,
"license": "MIT",
"summary": " ",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/ffreemt/fast-scores",
"Repository": "https://github.com/ffreemt/fast-scores"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1894d317d5702582146625ba9d3be10b795116e635af3f4fe5093bcbdf33a1bc",
"md5": "a0fa61e0a3b8aec7118e0572a5c2db62",
"sha256": "ee6dc1a08d8e0dd208922850792b75b9b4a44b91299b6afcd85e55837579c6fa"
},
"downloads": -1,
"filename": "fast_scores-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a0fa61e0a3b8aec7118e0572a5c2db62",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 1195693,
"upload_time": "2024-01-31T16:35:42",
"upload_time_iso_8601": "2024-01-31T16:35:42.122998Z",
"url": "https://files.pythonhosted.org/packages/18/94/d317d5702582146625ba9d3be10b795116e635af3f4fe5093bcbdf33a1bc/fast_scores-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ddf9c5ca7d03bfaa379ec975b49060848d489d7070d3b25fbe9574135899c883",
"md5": "df488321eaae4c9a390ffcb51f32f8d4",
"sha256": "5673b31b100a6531c7daae2eae9b38dca42a6c6655996cf2a4c367e2f1edd6a4"
},
"downloads": -1,
"filename": "fast_scores-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "df488321eaae4c9a390ffcb51f32f8d4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 1193370,
"upload_time": "2024-01-31T16:35:44",
"upload_time_iso_8601": "2024-01-31T16:35:44.132809Z",
"url": "https://files.pythonhosted.org/packages/dd/f9/c5ca7d03bfaa379ec975b49060848d489d7070d3b25fbe9574135899c883/fast_scores-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-31 16:35:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ffreemt",
"github_project": "fast-scores",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fast-scores"
}