Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
license: apache-2.0
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- javascript
|
8 |
+
- js
|
9 |
+
- code-search
|
10 |
+
- text-to-code
|
11 |
+
- code-to-text
|
12 |
+
- source-code
|
13 |
+
- frontend
|
14 |
+
- backend
|
15 |
+
- web-development
|
16 |
+
|
17 |
+
---
|
18 |
+
|
19 |
+
# Javascript CodeSearch Dataset (Shuu12121/javascript-treesitter-filtered-datasetsV2)
|
20 |
+
|
21 |
+
## Dataset Description
|
22 |
+
This dataset contains JavaScript functions and methods paired with their JSDoc comments, extracted from open-source JavaScript repositories on GitHub.
|
23 |
+
It is formatted similarly to the CodeSearchNet challenge dataset.
|
24 |
+
|
25 |
+
Each entry includes:
|
26 |
+
- `code`: The source code of a javascript function or method.
|
27 |
+
- `docstring`: The docstring or Javadoc associated with the function/method.
|
28 |
+
- `func_name`: The name of the function/method.
|
29 |
+
- `language`: The programming language (always "javascript").
|
30 |
+
- `repo`: The GitHub repository from which the code was sourced (e.g., "owner/repo").
|
31 |
+
- `path`: The file path within the repository where the function/method is located.
|
32 |
+
- `url`: A direct URL to the function/method's source file on GitHub (approximated to master/main branch).
|
33 |
+
- `license`: The SPDX identifier of the license governing the source repository (e.g., "MIT", "Apache-2.0").
|
34 |
+
Additional metrics if available (from Lizard tool):
|
35 |
+
- `ccn`: Cyclomatic Complexity Number.
|
36 |
+
- `params`: Number of parameters of the function/method.
|
37 |
+
- `nloc`: Non-commenting lines of code.
|
38 |
+
- `token_count`: Number of tokens in the function/method.
|
39 |
+
|
40 |
+
## Dataset Structure
|
41 |
+
The dataset is divided into the following splits:
|
42 |
+
|
43 |
+
- `train`: 703,354 examples
|
44 |
+
- `validation`: 41,899 examples
|
45 |
+
- `test`: 17,138 examples
|
46 |
+
|
47 |
+
## Data Collection
|
48 |
+
The data was collected by:
|
49 |
+
1. Identifying popular and relevant Javascript repositories on GitHub.
|
50 |
+
2. Cloning these repositories.
|
51 |
+
3. Parsing Javascript files (`.js`) using tree-sitter to extract functions/methods and their docstrings/Javadoc.
|
52 |
+
4. Filtering functions/methods based on code length and presence of a non-empty docstring/Javadoc.
|
53 |
+
5. Using the `lizard` tool to calculate code metrics (CCN, NLOC, params).
|
54 |
+
6. Storing the extracted data in JSONL format, including repository and license information.
|
55 |
+
7. Splitting the data by repository to ensure no data leakage between train, validation, and test sets.
|
56 |
+
|
57 |
+
## Intended Use
|
58 |
+
This dataset can be used for tasks such as:
|
59 |
+
- Training and evaluating models for code search (natural language to code).
|
60 |
+
- Code summarization / docstring generation (code to natural language).
|
61 |
+
- Studies on Javascript code practices and documentation habits.
|
62 |
+
|
63 |
+
## Licensing
|
64 |
+
The code examples within this dataset are sourced from repositories with permissive licenses (typically MIT, Apache-2.0, BSD).
|
65 |
+
Each sample includes its original license information in the `license` field.
|
66 |
+
The dataset compilation itself is provided under a permissive license (e.g., MIT or CC-BY-SA-4.0),
|
67 |
+
but users should respect the original licenses of the underlying code.
|
68 |
+
|
69 |
+
## Example Usage
|
70 |
+
```python
|
71 |
+
from datasets import load_dataset
|
72 |
+
|
73 |
+
# Load the dataset
|
74 |
+
dataset = load_dataset("Shuu12121/javascript-treesitter-filtered-datasetsV2")
|
75 |
+
|
76 |
+
# Access a split (e.g., train)
|
77 |
+
train_data = dataset["train"]
|
78 |
+
|
79 |
+
# Print the first example
|
80 |
+
print(train_data[0])
|
81 |
+
```
|