Shuu12121 commited on
Commit
53efefa
·
verified ·
1 Parent(s): cdb36d6

Upload README.md with huggingface_hub

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