Ksingleton commited on
Commit
546da07
·
1 Parent(s): 69b41d7

delete docs_to_json.py

Browse files
Files changed (1) hide show
  1. docs_to_jsonl.py +0 -37
docs_to_jsonl.py DELETED
@@ -1,37 +0,0 @@
1
- # Here is an example of a line in the jsonl file
2
- # {"text": "### Human: Hola### Assistant: \u00a1Hola! \u00bfEn qu\u00e9 puedo ayudarte hoy?"}
3
- import json
4
- import pathlib
5
-
6
- def main():
7
- questions = {
8
- '../kb_sdk_docs/source/howtos/add_ui_elements.rst': 'How do I add a ui element to a KBase module?',
9
- '../kb_sdk_docs/source/howtos/create_a_report.rst': 'How do I create a report for a KBase app?',
10
- '../kb_sdk_docs/source/howtos/dynamic_services.rst': 'How do I create a dynamic service for an SDK module?',
11
- '../kb_sdk_docs/source/howtos/edit_your_dockerfile.rst': 'How do I edit the dockerfile of a KBase app?',
12
- '../kb_sdk_docs/source/howtos/file_utils.rst': 'How do I acess the utilities of a file?',
13
- '../kb_sdk_docs/source/howtos/fill_out_app_information.rst': 'How do I complete the documentation for a KBase app?',
14
- '../kb_sdk_docs/source/howtos/job_manager.rst': 'How do I list and view the jobs running on KBase?',
15
- '../kb_sdk_docs/source/howtos/manual_build.rst': 'How do I manually build the KBase SDK?',
16
- '../kb_sdk_docs/source/howtos/run_a_shell_command.rst': 'How do I run shell commands in the dockerfile of a KBase app?',
17
- '../kb_sdk_docs/source/howtos/update_to_py3.rst': 'How do I update a KBase module to Python 3?',
18
- '../kb_sdk_docs/source/howtos/workspace.rst': 'How do I add reference data to a KBase app?',
19
- '../kb_sdk_docs/source/howtos/work_with_reference_data.rst': 'How do I retrieve the workspace object from a KBase narrative?',
20
- }
21
-
22
- kbase_files = pathlib.Path("../kb_sdk_docs/source/howtos")
23
- howtos = (list(kbase_files.iterdir()))
24
-
25
- with open("data.jsonl","w") as f:
26
- pass
27
- for howto in howtos:
28
- with open(howto) as f:
29
- answer = f.read()
30
- text = f'### Human: {questions[str(howto)]}### Assistant: {answer}'
31
- # dict(foo=100, bar=200)
32
- line = json.dumps(dict(text=text))
33
- with open("data.jsonl","a") as f:
34
- f.write(f'{line}\n')
35
-
36
- if __name__ == "__main__":
37
- main()