jreadability


Namejreadability JSON
Version 1.1.3 PyPI version JSON
download
home_pageNone
SummaryCalculate readability scores for Japanese texts.
upload_time2024-10-28 18:43:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Joshua Hamilton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords japanese readability
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img src="https://raw.githubusercontent.com/joshdavham/jreadability/0bb50f9ea65b2092dd3fdf2f2193d51cb394fe4d/logo.svg" height="75">
</div>
<br />

<div align="center">
    <i>Text readability calculator for Japanese learners πŸ‡―πŸ‡΅</i>
</div>

<br />

<div align="center" style="text-decoration: none;">
    <a href="https://pypi.org/project/jreadability/"><img src="https://img.shields.io/pypi/v/jreadability"></a>
    <a href="https://github.com/joshdavham/jreadability/blob/main/LICENSE" style="text-decoration: none;"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg"></a>
</div>

<br />

jReadability allows python developers to calculate the readability of Japanese text using the model developed by Jae-ho Lee and Yoichiro Hasebe in [Introducing a readability evaluation system for Japanese language education](https://jreadability.net/file/hasebe-lee-2015-castelj.pdf) and [Readability measurement of Japanese texts based on levelled corpora](https://researchmap.jp/jhlee/published_papers/21426109). **Note that this is not an official implementation.**

## Demo

You can play with an interactive demo [here](https://jreadability-demo.streamlit.app/).

## Installation
```
pip install jreadability
```

## Quickstart
```python
from jreadability import compute_readability

# "Good morning! The weather is nice today."
text = 'γŠγ―γ‚ˆγ†γ”γ–γ„γΎγ™οΌδ»Šζ—₯γ―ε€©ζ°—γŒγ„γ„γ§γ™γ­γ€‚' 

score = compute_readability(text)

print(score) # 6.438000000000001
```

## Readability scores

| Level              | Readability score range |
|--------------------|-------------------------|
| Upper-advanced     | [0.5, 1.5)                 |
| Lower-advanced     | [1.5, 2.5)               |
| Upper-intermediate | [2.5, 3.5)               |
| Lower-intermediate | [3.5, 4.5)               |
| Upper-elementary   | [4.5, 5.5)               |
| Lower-elementary   | [5.5, 6.5)               |

Note that this readability calculator is specifically for <u>non-native speakers</u> learning to read Japanese. This is not to be confused with something like grade level or other readability scores meant for native speakers.

### Model

```
readability = {mean number of words per sentence} * -0.056
            + {percentage of kango} * -0.126
            + {percentage of wago} * -0.042
            + {percentage of verbs} * -0.145
            + {percentage of particles} * -0.044
            + 11.724
```

*\* "kango" (ζΌ’θͺž) means Japanese word of Chinese origin while "wago" (ε’Œθͺž) means native Japanese word.*

#### Note on model consistency

The readability scores produced by this python package tend to differ slightly from the scores produced on the official [jreadability website](https://jreadability.net/sys/en). This is likely due to the version difference in UniDic between these two implementations as this package uses UniDic 2.1.2 while theirs uses UniDic 2.2.0. This issue may be resolved in the future.

## Batch processing

jreadability makes use of [fugashi](https://github.com/polm/fugashi)'s tagger under the hood and initializes a new tagger everytime `compute_readability` is invoked. If you are processing a large number of texts, it is recommended to initialize the tagger first on your own, then pass it as an argument to each subsequent `compute_readability` call.

```python
from fugashi import Tagger

texts = [...]

tagger = Tagger()

for text in texts:
    
    score = compute_readability(text, tagger) # fast :D
    #score = compute_readability(text) # slow :'(
    ...
```

## Other implementations

The official jReadability implementation can be found on [jreadability.net](https://jreadability.net/)

A node.js implementation can also be found [here](https://github.com/Bennycopter/jreadability).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "jreadability",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "japanese, readability",
    "author": null,
    "author_email": "Joshua Hamilton <hamiltonjoshuadavid@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/71/27/9480455e640c30d6a2ae85f00c3d50a79cbf031d386d7fa9897ae0427f28/jreadability-1.1.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/joshdavham/jreadability/0bb50f9ea65b2092dd3fdf2f2193d51cb394fe4d/logo.svg\" height=\"75\">\n</div>\n<br />\n\n<div align=\"center\">\n    <i>Text readability calculator for Japanese learners \ud83c\uddef\ud83c\uddf5</i>\n</div>\n\n<br />\n\n<div align=\"center\" style=\"text-decoration: none;\">\n    <a href=\"https://pypi.org/project/jreadability/\"><img src=\"https://img.shields.io/pypi/v/jreadability\"></a>\n    <a href=\"https://github.com/joshdavham/jreadability/blob/main/LICENSE\" style=\"text-decoration: none;\"><img src=\"https://img.shields.io/badge/License-MIT-brightgreen.svg\"></a>\n</div>\n\n<br />\n\njReadability allows python developers to calculate the readability of Japanese text using the model developed by Jae-ho Lee and Yoichiro Hasebe in [Introducing a readability evaluation system for Japanese language education](https://jreadability.net/file/hasebe-lee-2015-castelj.pdf) and [Readability measurement of Japanese texts based on levelled corpora](https://researchmap.jp/jhlee/published_papers/21426109). **Note that this is not an official implementation.**\n\n## Demo\n\nYou can play with an interactive demo [here](https://jreadability-demo.streamlit.app/).\n\n## Installation\n```\npip install jreadability\n```\n\n## Quickstart\n```python\nfrom jreadability import compute_readability\n\n# \"Good morning! The weather is nice today.\"\ntext = '\u304a\u306f\u3088\u3046\u3054\u3056\u3044\u307e\u3059\uff01\u4eca\u65e5\u306f\u5929\u6c17\u304c\u3044\u3044\u3067\u3059\u306d\u3002' \n\nscore = compute_readability(text)\n\nprint(score) # 6.438000000000001\n```\n\n## Readability scores\n\n| Level              | Readability score range |\n|--------------------|-------------------------|\n| Upper-advanced     | [0.5, 1.5)                 |\n| Lower-advanced     | [1.5, 2.5)               |\n| Upper-intermediate | [2.5, 3.5)               |\n| Lower-intermediate | [3.5, 4.5)               |\n| Upper-elementary   | [4.5, 5.5)               |\n| Lower-elementary   | [5.5, 6.5)               |\n\nNote that this readability calculator is specifically for <u>non-native speakers</u> learning to read Japanese. This is not to be confused with something like grade level or other readability scores meant for native speakers.\n\n### Model\n\n```\nreadability = {mean number of words per sentence} * -0.056\n            + {percentage of kango} * -0.126\n            + {percentage of wago} * -0.042\n            + {percentage of verbs} * -0.145\n            + {percentage of particles} * -0.044\n            + 11.724\n```\n\n*\\* \"kango\" (\u6f22\u8a9e) means Japanese word of Chinese origin while \"wago\" (\u548c\u8a9e) means native Japanese word.*\n\n#### Note on model consistency\n\nThe readability scores produced by this python package tend to differ slightly from the scores produced on the official [jreadability website](https://jreadability.net/sys/en). This is likely due to the version difference in UniDic between these two implementations as this package uses UniDic 2.1.2 while theirs uses UniDic 2.2.0. This issue may be resolved in the future.\n\n## Batch processing\n\njreadability makes use of [fugashi](https://github.com/polm/fugashi)'s tagger under the hood and initializes a new tagger everytime `compute_readability` is invoked. If you are processing a large number of texts, it is recommended to initialize the tagger first on your own, then pass it as an argument to each subsequent `compute_readability` call.\n\n```python\nfrom fugashi import Tagger\n\ntexts = [...]\n\ntagger = Tagger()\n\nfor text in texts:\n    \n    score = compute_readability(text, tagger) # fast :D\n    #score = compute_readability(text) # slow :'(\n    ...\n```\n\n## Other implementations\n\nThe official jReadability implementation can be found on [jreadability.net](https://jreadability.net/)\n\nA node.js implementation can also be found [here](https://github.com/Bennycopter/jreadability).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Joshua Hamilton  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Calculate readability scores for Japanese texts.",
    "version": "1.1.3",
    "project_urls": {
        "homepage": "https://github.com/joshdavham/jreadability"
    },
    "split_keywords": [
        "japanese",
        " readability"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "736f83f32e220432bb3cedf10498510ab208ea7136d4c3acd07f74f70b7ed067",
                "md5": "b44dc3a0ec0eb585305cf6bcfdf22184",
                "sha256": "9ce3a3662edff6270a16a94059dd15c1f5582b3ef678a86cf11ea1c49849a26b"
            },
            "downloads": -1,
            "filename": "jreadability-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b44dc3a0ec0eb585305cf6bcfdf22184",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6061,
            "upload_time": "2024-10-28T18:43:06",
            "upload_time_iso_8601": "2024-10-28T18:43:06.360233Z",
            "url": "https://files.pythonhosted.org/packages/73/6f/83f32e220432bb3cedf10498510ab208ea7136d4c3acd07f74f70b7ed067/jreadability-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71279480455e640c30d6a2ae85f00c3d50a79cbf031d386d7fa9897ae0427f28",
                "md5": "4c94dd432f848dd49c6fb697f06a46eb",
                "sha256": "c42d3c4ee1370ee919df0d20afb666eb65d4a5a5a912d23744a7534d6d412446"
            },
            "downloads": -1,
            "filename": "jreadability-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4c94dd432f848dd49c6fb697f06a46eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11849,
            "upload_time": "2024-10-28T18:43:07",
            "upload_time_iso_8601": "2024-10-28T18:43:07.344839Z",
            "url": "https://files.pythonhosted.org/packages/71/27/9480455e640c30d6a2ae85f00c3d50a79cbf031d386d7fa9897ae0427f28/jreadability-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-28 18:43:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshdavham",
    "github_project": "jreadability",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "jreadability"
}
        
Elapsed time: 1.23474s