Ching Yi, Chan commited on
Commit
a4379f9
·
1 Parent(s): fa107bb

Signed-off-by: Ching Yi, Chan <qrtt1@infuseai.io>

Files changed (5) hide show
  1. .gitignore +319 -0
  2. README.md +4 -0
  3. build.py +42 -0
  4. data.jsonl +0 -0
  5. requirements.txt +4 -0
.gitignore ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ # Created by https://www.toptal.com/developers/gitignore/api/pycharm,visualstudiocode,vim,macos
132
+ # Edit at https://www.toptal.com/developers/gitignore?templates=pycharm,visualstudiocode,vim,macos
133
+
134
+ ### macOS ###
135
+ # General
136
+ .DS_Store
137
+ .AppleDouble
138
+ .LSOverride
139
+
140
+ # Icon must end with two \r
141
+ Icon
142
+
143
+ # Thumbnails
144
+ ._*
145
+
146
+ # Files that might appear in the root of a volume
147
+ .DocumentRevisions-V100
148
+ .fseventsd
149
+ .Spotlight-V100
150
+ .TemporaryItems
151
+ .Trashes
152
+ .VolumeIcon.icns
153
+ .com.apple.timemachine.donotpresent
154
+
155
+ # Directories potentially created on remote AFP share
156
+ .AppleDB
157
+ .AppleDesktop
158
+ Network Trash Folder
159
+ Temporary Items
160
+ .apdisk
161
+
162
+ ### PyCharm ###
163
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
164
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
165
+
166
+ # User-specific stuff
167
+ .idea/**/workspace.xml
168
+ .idea/**/tasks.xml
169
+ .idea/**/usage.statistics.xml
170
+ .idea/**/dictionaries
171
+ .idea/**/shelf
172
+
173
+ # AWS User-specific
174
+ .idea/**/aws.xml
175
+
176
+ # Generated files
177
+ .idea/**/contentModel.xml
178
+
179
+ # Sensitive or high-churn files
180
+ .idea/**/dataSources/
181
+ .idea/**/dataSources.ids
182
+ .idea/**/dataSources.local.xml
183
+ .idea/**/sqlDataSources.xml
184
+ .idea/**/dynamic.xml
185
+ .idea/**/uiDesigner.xml
186
+ .idea/**/dbnavigator.xml
187
+
188
+ # Gradle
189
+ .idea/**/gradle.xml
190
+ .idea/**/libraries
191
+
192
+ # Gradle and Maven with auto-import
193
+ # When using Gradle or Maven with auto-import, you should exclude module files,
194
+ # since they will be recreated, and may cause churn. Uncomment if using
195
+ # auto-import.
196
+ # .idea/artifacts
197
+ # .idea/compiler.xml
198
+ # .idea/jarRepositories.xml
199
+ # .idea/modules.xml
200
+ # .idea/*.iml
201
+ # .idea/modules
202
+ # *.iml
203
+ # *.ipr
204
+
205
+ # CMake
206
+ cmake-build-*/
207
+
208
+ # Mongo Explorer plugin
209
+ .idea/**/mongoSettings.xml
210
+
211
+ # File-based project format
212
+ *.iws
213
+
214
+ # IntelliJ
215
+ out/
216
+
217
+ # mpeltonen/sbt-idea plugin
218
+ .idea_modules/
219
+
220
+ # JIRA plugin
221
+ atlassian-ide-plugin.xml
222
+
223
+ # Cursive Clojure plugin
224
+ .idea/replstate.xml
225
+
226
+ # SonarLint plugin
227
+ .idea/sonarlint/
228
+
229
+ # Crashlytics plugin (for Android Studio and IntelliJ)
230
+ com_crashlytics_export_strings.xml
231
+ crashlytics.properties
232
+ crashlytics-build.properties
233
+ fabric.properties
234
+
235
+ # Editor-based Rest Client
236
+ .idea/httpRequests
237
+
238
+ # Android studio 3.1+ serialized cache file
239
+ .idea/caches/build_file_checksums.ser
240
+
241
+ ### PyCharm Patch ###
242
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
243
+
244
+ # *.iml
245
+ # modules.xml
246
+ # .idea/misc.xml
247
+ # *.ipr
248
+
249
+ # Sonarlint plugin
250
+ # https://plugins.jetbrains.com/plugin/7973-sonarlint
251
+ .idea/**/sonarlint/
252
+
253
+ # SonarQube Plugin
254
+ # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
255
+ .idea/**/sonarIssues.xml
256
+
257
+ # Markdown Navigator plugin
258
+ # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
259
+ .idea/**/markdown-navigator.xml
260
+ .idea/**/markdown-navigator-enh.xml
261
+ .idea/**/markdown-navigator/
262
+
263
+ # Cache file creation bug
264
+ # See https://youtrack.jetbrains.com/issue/JBR-2257
265
+ .idea/$CACHE_FILE$
266
+
267
+ # CodeStream plugin
268
+ # https://plugins.jetbrains.com/plugin/12206-codestream
269
+ .idea/codestream.xml
270
+
271
+ ### Vim ###
272
+ # Swap
273
+ [._]*.s[a-v][a-z]
274
+ !*.svg # comment out if you don't need vector files
275
+ [._]*.sw[a-p]
276
+ [._]s[a-rt-v][a-z]
277
+ [._]ss[a-gi-z]
278
+ [._]sw[a-p]
279
+
280
+ # Session
281
+ Session.vim
282
+ Sessionx.vim
283
+
284
+ # Temporary
285
+ .netrwhist
286
+ *~
287
+ # Auto-generated tag files
288
+ tags
289
+ # Persistent undo
290
+ [._]*.un~
291
+
292
+ ### VisualStudioCode ###
293
+ .vscode/*
294
+ !.vscode/settings.json
295
+ !.vscode/tasks.json
296
+ !.vscode/launch.json
297
+ !.vscode/extensions.json
298
+ !.vscode/*.code-snippets
299
+
300
+ # Local History for Visual Studio Code
301
+ .history/
302
+
303
+ # Built Visual Studio Code Extensions
304
+ *.vsix
305
+
306
+ ### VisualStudioCode Patch ###
307
+ # Ignore all local history of files
308
+ .history
309
+ .ionide
310
+
311
+ # Support for Project snippet scope
312
+ .idea
313
+ # End of https://www.toptal.com/developers/gitignore/api/pycharm,visualstudiocode,vim,macos
314
+ piperider/
315
+
316
+ pnpm-lock.yaml
317
+ *.sum
318
+
319
+ kautian.ods
README.md CHANGED
@@ -1,3 +1,7 @@
1
  ---
2
  license: cc-by-nd-4.0
 
 
 
 
3
  ---
 
1
  ---
2
  license: cc-by-nd-4.0
3
+
4
+ configs:
5
+ - config_name: default
6
+ data_files: "data.jsonl"
7
  ---
build.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import requests
4
+ import pandas as pd
5
+ from datasets import Dataset
6
+
7
+ # The URL from which to download the data
8
+ FILENAME = 'kautian.ods'
9
+ DOWNLOAD_URL = f"https://sutian.moe.edu.tw/media/{FILENAME}"
10
+
11
+
12
+ def download_file():
13
+ response = requests.get(DOWNLOAD_URL)
14
+ if response.status_code == 200:
15
+ with open(FILENAME, 'wb') as file:
16
+ file.write(response.content)
17
+ return True
18
+ return False
19
+
20
+
21
+ def save_dataset_to_jsonl(dataset, file_path):
22
+ with open(file_path, 'w', encoding='utf-8') as f:
23
+ for example in dataset:
24
+ json_line = json.dumps(example, ensure_ascii=False)
25
+ f.write(json_line + '\n')
26
+
27
+
28
+ def main():
29
+ if not download_file():
30
+ print("File download failed")
31
+ return
32
+
33
+ df = pd.read_excel(FILENAME, engine='odf', sheet_name='例句')
34
+ df = df.loc[:, ['漢字', '羅馬字', '華語']]
35
+ df = df.rename(columns={'漢字': 'chinese_characters', '羅馬字': 'romanization', '華語': 'mandarin'})
36
+
37
+ dataset = Dataset.from_pandas(df)
38
+ save_dataset_to_jsonl(dataset, 'data.jsonl')
39
+
40
+
41
+ if __name__ == '__main__':
42
+ main()
data.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ requests
2
+ pandas
3
+ odfpy
4
+ datasets