rehaidib commited on
Commit
5e85025
Β·
verified Β·
1 Parent(s): bbd403d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -0
README.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - software-engineering
6
+ - code-analysis
7
+ - refactoring
8
+ - AST
9
+ - lexical-features
10
+ - Python
11
+ - static-analysis
12
+ task_categories:
13
+ - code-understanding
14
+ - code-search
15
+ - software-quality
16
+ pretty_name: "Python Function-Level AST and Lexical Features Dataset"
17
+ dataset_name: "python_function_ast_lexical_features"
18
+ size_categories:
19
+ - 1M<n<100M
20
+ ---
21
+
22
+ # πŸ“Š Python Function-Level AST and Lexical Features Dataset
23
+
24
+ ## πŸ“ Dataset Summary
25
+
26
+ This dataset integrates **function-level static analysis data** from Python repositories.
27
+ It merges three data sources:
28
+
29
+ 1. **Lizard Cyclomatic Analysis**: provides complexity, NLOC, and basic function metadata.
30
+ 2. **AST Extracted Features**: includes detailed abstract syntax tree information such as token counts, parameters, variable extraction, and function bodies.
31
+ 3. **Lexical Features**: captures lexical and structural features of each function (e.g., class structure, modifiers, incoming/outgoing calls, and statement types).
32
+
33
+ The resulting **Dataset** represents each Python function as a unified row combining complexity metrics, lexical information, and AST structure β€” enabling advanced research in:
34
+ - Code comprehension
35
+ - Automated refactoring
36
+ - Software quality analysis
37
+ - Function-level code search
38
+ - Maintainability prediction
39
+ - ML model training for software engineering tasks
40
+
41
+ ---
42
+
43
+ ## πŸ“‚ Dataset Structure
44
+
45
+ Each row corresponds to **one Python function** identified across open-source repositories.
46
+
47
+ ### Columns
48
+
49
+ | Column name | Description |
50
+ |------------------------------|---------------------------------------------------------------------------------------------------|
51
+ | `project_name` | Repository name |
52
+ | `class_name` | Class name containing the function (if applicable) |
53
+ | `class_modifiers` | Access modifiers of the class |
54
+ | `class_implements` | Interfaces implemented |
55
+ | `class_extends` | Class inheritance |
56
+ | `function_name` | Function name |
57
+ | `function_body` | Raw function body code |
58
+ | `cyclomatic_complexity` | Cyclomatic complexity measure |
59
+ | `NLOC` | Number of lines of code |
60
+ | `num_parameter` | Number of function parameters |
61
+ | `num_token` | Number of tokens |
62
+ | `num_variable` | Number of variables detected in function |
63
+ | `start_line` / `end_line` | Start and end line of the function in the file |
64
+ | `function_index` | Function index in AST parsing |
65
+ | `function_params` | Parameter names |
66
+ | `function_variable` | Variable names extracted |
67
+ | `function_return_type` | Return type (if inferred) |
68
+ | `function_body_line_type`| Mapping of statement types inside the function (e.g., Assign, If, Return) |
69
+ | `function_num_functions` | Number of functions declared inside |
70
+ | `function_num_lines` | Number of lines of function (lexical) |
71
+ | `outgoing_function_count` / `outgoing_function_names` | Number and names of functions called inside this function |
72
+ | `incoming_function_count` / `incoming_function_names` | Number and names of functions calling this function |
73
+
74
+ ---
75
+
76
+ ## βš™οΈ Data Sources
77
+
78
+ - Static analysis performed on public Python repositories cloned from [GitHub](https://github.com) that apply the following characteristics (python language projects, commits > 500, and contributors > 10).
79
+ - Function-level analysis uses:
80
+ - [`lizard`](https://github.com/terryyin/lizard) for cyclomatic complexity.
81
+ - Python AST parsing for structural features.
82
+ - Custom lexical parser for lexical metadata and call graphs.
83
+
84
+ ---
85
+
86
+ ## πŸ§ͺ Dataset Creation
87
+
88
+ ### Collection
89
+ 1. Clone open-source Python repositories.
90
+ 2. Run Lizard static analysis to generate base metrics.
91
+ 3. Parse source files to extract AST and lexical features.
92
+ 4. Merge the three sources