Shuu12121's picture
Update README.md
adc9b8f verified
|
raw
history blame contribute delete
3.53 kB
---
license: other
language: go
pretty_name: go Code Dataset (go-codesearch-dataset-openV2)
tags:
- code
- go
- codesearchnet-format
- source-code
- documentation
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: validation
path: data/validation-*
- split: test
path: data/test-*
dataset_info:
features:
- name: code
dtype: string
- name: docstring
dtype: string
- name: func_name
dtype: string
- name: language
dtype: string
- name: repo
dtype: string
- name: path
dtype: string
- name: url
dtype: string
- name: license
dtype: string
splits:
- name: train
num_bytes: 342049797
num_examples: 388495
- name: validation
num_bytes: 33499822
num_examples: 43941
- name: test
num_bytes: 1172721
num_examples: 1736
download_size: 96158755
dataset_size: 376722340
---
# go Code Dataset (go-codesearch-dataset-open)
## Dataset Description
This dataset contains go 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.
### Features
The dataset includes the following features for each sample:
- `code`: The go method's source code (from `def` to `end`).
- `docstring`: The documentation comment associated with the method.
- `func_name`: The name of the method (function).
- `language`: The programming language (always `"go"`).
- `repo`: The full name of the source GitHub repository (e.g., `rails/rails`).
- `path`: The relative file path within the source repository.
- `url`: A GitHub URL pointing to the source file (usually on the master/main branch).
- `license`: The SPDX identifier of the license declared for the source repository (e.g., `MIT`, `Apache-2.0`, `go`, or `NO LICENSE`).
## Dataset Structure
The dataset is divided into the following splits:
- `train`: 388,495 examples
- `validation`: 43,941 examples
- `test`: 1,736 examples
**Total Examples:** 434,172
## Usage
You can load and use this dataset using the `datasets` library:
```python
from datasets import load_dataset
# Load the dataset from the Hugging Face Hub
dataset = load_dataset("Shuu12121/go-codesearch-dataset-open")
# Access a specific split (e.g., training split)
train_data = dataset["train"]
# Explore the data
print(f"Number of training samples: {len(train_data):,}")
print("\nFirst training sample:")
print(train_data[0])
# Example: Access code and docstring of the first sample
first_sample = train_data[0]
print("\nMethod Name:", first_sample['func_name'])
print("\nDocstring:\n", first_sample['docstring'])
# print("\nCode Snippet:\n", first_sample['code'][:500] + "...") # Print first 500 chars of code
```
## Licensing
The code snippets included in this dataset are sourced from various GitHub repositories under different licenses (MIT, Apache-2.0, go 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.
## Disclaimer
This dataset was generated through an automated process. While efforts were made to accurately extract methods and documentation, there might be errors or inaccuracies.