--- task_categories: - summarization language: - en tags: - code size_categories: - 10K : , : , : , : , : , : , : , : } ``` # The AST Sequence A function recursively converts the AST tree into a linear sequence. It uses depth markers (├1>, └2>, etc.) to show parent-child relationships. It also adds node identifiers by pairing each node type with a meaningful identifier. Furthermore, pruning is also applied to irrelevant and shallow identifiers to denoise the dataset. Here's an example of how the AST sequence is generated: Example Code ``` def calculate_area(radius): """ Calculate the area of a circle. Parameters: radius (float): The radius of the circle Returns: float: The area of the circle """ PI = 3.14159 area = PI * radius * radius return area ``` Resulting AST Sequence ``` FunctionDef:calculate_area ├1> args:[radius] ├1> Assign:PI │ └2> Constant: ├1> Assign:area │ └2> BinOp: │ ├3> BinOp: │ │ ├4> Name:PI │ │ └4> Name:radius │ └3> Name:radius └1> Return: └2> Name:area ``` 1. The code is parsed via Python's `ast` module 2. A method traverses this tree and linearizes the sequence 3. Each node is then converted to a string with type-identifier keys 4. Structural relationships are preserved using the depth markers 5. Denoising of irrelevant and shallow nodes are applied # Preprocessing The following preprocessing steps were applied: ## Text Cleaning - Removed comments - Filtering unusual/control characters - Removed trailing whitespaces - Converts all whitespace into a single spaces - Removed tags from docstrings ## AST Cleaning - Removed noise using a custom blacklist - Removed abnormally long nodes (>100) - Stripped blank AST entries - Ensured ASTs start with the proper root nodes (FunctionDef or ClassDef) ## Language Filtering - Removed non-English documentations - Keeps an item if detection fails ## Similarity Filtering - Removed entries where similarity exceeds threshold (0.7) # Split - Dataset was split into a 70/15/15 ratio