Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -34,8 +34,8 @@ This dataset is an adaptation of [KanjiVG](https://github.com/KanjiVG/kanjivg) b
|
|
34 |
|
35 |
## Usage
|
36 |
```python
|
37 |
-
>>>
|
38 |
-
>>> data=load_dataset("davidstap/kanji_definitions")
|
39 |
>>> data
|
40 |
DatasetDict({
|
41 |
train: Dataset({
|
@@ -54,6 +54,20 @@ Dataset({
|
|
54 |
<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=1024x1024 at 0x7F1B037E5600>
|
55 |
```
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
## Modifications from Original
|
58 |
- Converted SVG files to 1024x1024 PNG format
|
59 |
- Added descriptive text for each Kanji character
|
|
|
34 |
|
35 |
## Usage
|
36 |
```python
|
37 |
+
>>> import datasets
|
38 |
+
>>> data = datasets.load_dataset("davidstap/kanji_definitions")
|
39 |
>>> data
|
40 |
DatasetDict({
|
41 |
train: Dataset({
|
|
|
54 |
<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=1024x1024 at 0x7F1B037E5600>
|
55 |
```
|
56 |
|
57 |
+
|
58 |
+
Note that some kanji characters have multiple meanings, which are separated by commas. You can expand entries to include the same image for each meaning by doing:
|
59 |
+
|
60 |
+
```python
|
61 |
+
>>> new_data = (
|
62 |
+
... datasets.Dataset.from_dict(
|
63 |
+
... {
|
64 |
+
... 'image': [img for img, txt in zip(data['train']['image'], data['train']['text']) for _ in txt.split(',')],
|
65 |
+
... 'text': [desc.strip() for txt in data['train']['text'] for desc in txt.split(',')]
|
66 |
+
... }
|
67 |
+
... )
|
68 |
+
... )
|
69 |
+
```
|
70 |
+
|
71 |
## Modifications from Original
|
72 |
- Converted SVG files to 1024x1024 PNG format
|
73 |
- Added descriptive text for each Kanji character
|