Skip to content

Commit

Permalink
Merge pull request #3 from joshdavham/v1.1.1
Browse files Browse the repository at this point in the history
V1.1.1
  • Loading branch information
joshdavham authored Sep 28, 2024
2 parents bd8a0db + c7626e2 commit 1602c94
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<br />

jreadability allows python developers to calculate the readability of Japanese text using the model developed by Jae-ho Lee and Yoichiro Hasebe in "[Readability measurement of Japanese texts based on levelled corpora](https://researchmap.jp/jhlee/published_papers/21426109)." **Note that this is not an official implementation.**
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)." **Note that this is not an official implementation.**


## Installation
Expand All @@ -33,7 +33,7 @@ text = 'おはようございます!今日は天気がいいですね。'

score = compute_readability(text)

print(score) # 5.596333333333334
print(score) # 6.438000000000001
```

## Readability scores
Expand All @@ -56,15 +56,15 @@ readability = {mean number of words per sentence} * -0.056
+ {proportion of kango} * -0.126
+ {proportion of wago} * -0.042
+ {proportion of verbs} * -0.145
+ {proportion of auxiliary verbs} * -0.044
+ {proportion 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 will hopefully be resolved in the future.
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

Expand All @@ -82,4 +82,10 @@ 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).
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "jreadability"
version = "1.1.0"
version = "1.1.1"
description = "Calculate readability scores for Japanese texts."
readme = "README.md"
authors = [{ name = "Joshua Hamilton", email = "[email protected]" }]
Expand Down
24 changes: 11 additions & 13 deletions tests/test_jreadability.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,17 @@ def test_lower_intermediate(self):

assert 3.5 <= score < 4.5

# test currently failing (score=4.19)
#def test_upper_elementary(self):
#
# score = compute_readability(upper_elementary_text)
#
# assert 4.5 <= score < 5.5

# test currently failing (score=5.12)
#def test_lower_elementary(self):
#
# score = compute_readability(lower_elementary_text)
#
# assert 5.5 <= score < 6.5
def test_upper_elementary(self):

score = compute_readability(upper_elementary_text)

assert 4.5 <= score < 5.5

def test_lower_elementary(self):

score = compute_readability(lower_elementary_text)

assert 5.5 <= score < 6.5

def test_batch(self):

Expand Down

0 comments on commit 1602c94

Please sign in to comment.