Upload dataset README
Browse files
README.md
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
license: other # データセット自体ではなく、含まれるコードのライセンスは多様
|
4 |
+
language: php
|
5 |
+
pretty_name: php Code Dataset (php-codesearch-dataset-openV2)
|
6 |
+
tags:
|
7 |
+
- code
|
8 |
+
- php
|
9 |
+
- codesearchnet-format
|
10 |
+
- source-code
|
11 |
+
- documentation
|
12 |
+
---
|
13 |
+
|
14 |
+
# php Code Dataset (php-codesearch-dataset-openV2)
|
15 |
+
|
16 |
+
## Dataset Description
|
17 |
+
|
18 |
+
This dataset contains php methods (functions) along with their documentation comments (typically `#` comments preceding the `def` line), extracted from various GitHub repositories. It follows a format similar to CodeSearchNet.
|
19 |
+
|
20 |
+
### Features
|
21 |
+
|
22 |
+
The dataset includes the following features for each sample:
|
23 |
+
|
24 |
+
- `code`: The php method's source code (from `def` to `end`).
|
25 |
+
- `docstring`: The documentation comment associated with the method.
|
26 |
+
- `func_name`: The name of the method (function).
|
27 |
+
- `language`: The programming language (always `"php"`).
|
28 |
+
- `repo`: The full name of the source GitHub repository (e.g., `rails/rails`).
|
29 |
+
- `path`: The relative file path within the source repository.
|
30 |
+
- `url`: A GitHub URL pointing to the source file (usually on the master/main branch).
|
31 |
+
- `license`: The SPDX identifier of the license declared for the source repository (e.g., `MIT`, `Apache-2.0`, `php`, or `NO LICENSE`).
|
32 |
+
|
33 |
+
## Dataset Structure
|
34 |
+
|
35 |
+
The dataset is divided into the following splits:
|
36 |
+
|
37 |
+
- `train`: 1,326,581 examples
|
38 |
+
- `validation`: 11,192 examples
|
39 |
+
- `test`: 60,519 examples
|
40 |
+
|
41 |
+
**Total Examples:** 1,398,292
|
42 |
+
|
43 |
+
## Usage
|
44 |
+
|
45 |
+
You can load and use this dataset using the `datasets` library:
|
46 |
+
|
47 |
+
```python
|
48 |
+
from datasets import load_dataset
|
49 |
+
|
50 |
+
# Load the dataset from the Hugging Face Hub
|
51 |
+
dataset = load_dataset("Shuu12121/php-codesearch-dataset-openV2")
|
52 |
+
|
53 |
+
# Access a specific split (e.g., training split)
|
54 |
+
train_data = dataset["train"]
|
55 |
+
|
56 |
+
# Explore the data
|
57 |
+
print(f"Number of training samples: {len(train_data):,}")
|
58 |
+
print("\nFirst training sample:")
|
59 |
+
print(train_data[0])
|
60 |
+
|
61 |
+
# Example: Access code and docstring of the first sample
|
62 |
+
first_sample = train_data[0]
|
63 |
+
print("\nMethod Name:", first_sample['func_name'])
|
64 |
+
print("\nDocstring:\n", first_sample['docstring'])
|
65 |
+
# print("\nCode Snippet:\n", first_sample['code'][:500] + "...") # Print first 500 chars of code
|
66 |
+
```
|
67 |
+
|
68 |
+
## Data Collection
|
69 |
+
|
70 |
+
The data was collected by:
|
71 |
+
1. Searching for popular and recent php repositories on GitHub.
|
72 |
+
2. Cloning the repositories (shallow clone).
|
73 |
+
3. Identifying php files (`.php`).
|
74 |
+
4. Using the `lizard` tool to parse the code and identify method definitions.
|
75 |
+
5. Extracting the method code and the preceding `#` comment lines as documentation.
|
76 |
+
6. Filtering out methods without documentation or with very short code.
|
77 |
+
7. Recording metadata like repository name, file path, and license.
|
78 |
+
8. Splitting the data by repository (80% train, 10% validation, 10% test) to prevent data leakage between splits.
|
79 |
+
|
80 |
+
## Licensing
|
81 |
+
|
82 |
+
The code snippets included in this dataset are sourced from various GitHub repositories under different licenses (MIT, Apache-2.0, php License, BSD clauses, etc.). **Each data sample contains a `license` field indicating the license of the source repository.** Users of this dataset should be aware of and respect the original licenses when using the code snippets. The dataset itself (the collection and organization) is provided under a permissive license, but the underlying code snippets retain their original licenses.
|
83 |
+
|
84 |
+
## Disclaimer
|
85 |
+
|
86 |
+
This dataset was generated through an automated process. While efforts were made to accurately extract methods and documentation, there might be errors or inaccuracies.
|