-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodex.py
More file actions
18 lines (14 loc) · 706 Bytes
/
codex.py
File metadata and controls
18 lines (14 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from Modules.Code2Code.Extracontent.code_snippet_dataset import CodeSnippetDataset
from Modules.Code2Explanation.code2doc import Code2DocModule
MAX_FUNCTION_STRING_LENGTH = 512
N_SNIPPETS = 100
DOCUMENTATION_INFERENCE_BATCH_SIZE = 4
# Get Dataset
dataset = CodeSnippetDataset(github=False, languages=["Python"])
code_snippets = dataset.get_n_snippets(N_SNIPPETS, max_length=MAX_FUNCTION_STRING_LENGTH)
print("Got snippets!")
code2doc = Code2DocModule()
for func in code_snippets['function']:
print("Steps: " + code2doc.get_codex_doc(func, "steps"))
# print("Purpose: " + code2doc.get_gpt_doc(func, "purpose"))
# print("Detailed Description: " + code2doc.get_gpt_doc(func, "detailed_description"))