What problem does it solve?
This Skill automates the semantic labeling of code, facilitating the mapping of code nodes to urban business semantics, which is crucial for urban brain applications.
Core Features & Use Cases
- Semantic Labeling: Maps code nodes to urban business semantics using a combination of rule-based and LLM-based approaches.
- AST Analysis: Uses code-to-ast-new for AST analysis to extract core variables and function calls.
- Code Summarization: Summarizes code to provide an overall semantic understanding when rules do not match.
- Use Case: Imagine you have a large codebase in a city brain application. Use this Skill to automatically label nodes in the code, aiding in understanding and managing the codebase.
Quick Start
To analyze code using the code-semantic-labeler skill, use the following command:
python scripts/label.py --code "import cv2\n\n# 读取视频\ncap = cv2.VideoCapture(0)\n\n# 目标检测\nresults = model.predict(frame)\n\n# 目标跟踪\ntracks = tracker.update(results)\n\n# 保存结果\ndb.save(tracks)"