https://github.com/tueda/shikaku
Toolbox for Japanese text.
https://github.com/tueda/shikaku
Last synced: 5 months ago
JSON representation
Toolbox for Japanese text.
- Host: GitHub
- URL: https://github.com/tueda/shikaku
- Owner: tueda
- License: mit
- Created: 2023-11-05T04:39:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-24T07:24:07.000Z (7 months ago)
- Last Synced: 2025-11-27T22:33:34.500Z (7 months ago)
- Language: Python
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Shikaku (詩客)
[](https://github.com/tueda/shikaku/actions/workflows/test.yml?query=branch%3Amain)
[](https://pypi.org/project/shikaku/)
Toolbox for Japanese text.
## Example
```python
from shikaku import load_aozorabunko, TextModel, WordCloud
import matplotlib.pyplot as plt
# Aozora Bunko, author_id = 35, work_id = 1567 ==> Run, Melos!
text = load_aozorabunko(35, 1567)
# Text generator using Markov chains.
model = TextModel()
model.fit(text)
result = model.generate()
print(result)
# Word cloud.
wc = WordCloud()
wc.fit(text)
result = wc.generate()
result.to_file("wc.png")
# Visualize Markov chains (preliminary).
model = TextModel(state_size=1)
model.fit("吾輩は猫である。名前はまだない。")
model.plot()
plt.savefig("model.png")
```