MCPcopy Create free account
hub / github.com/tirth8205/code-review-graph / _split_identifier

Function _split_identifier

code_review_graph/embeddings.py:781–796  ·  view source on GitHub ↗

Split snake_case / camelCase / PascalCase / dotted into space-separated words. Examples: get_route_handler -> "get route handler" APIRoute -> "API Route" dispatch_request -> "dispatch request" full_dispatch_request -> "full dispatch request"

(name: str)

Source from the content-addressed store, hash-verified

779
780
781def _split_identifier(name: str) -> str:
782 """Split snake_case / camelCase / PascalCase / dotted into space-separated words.
783
784 Examples:
785 get_route_handler -> "get route handler"
786 APIRoute -> "API Route"
787 dispatch_request -> "dispatch request"
788 full_dispatch_request -> "full dispatch request"
789 """
790 if not name:
791 return ""
792 # Insert space between lowercase->uppercase transitions, then collapse
793 # snake_case / dotted / hyphenated separators.
794 spaced = re.sub(r"([a-z])([A-Z])", r"\1 \2", name)
795 spaced = re.sub(r"[_./\-]+", " ", spaced)
796 return " ".join(spaced.split())
797
798
799def _node_to_text(node: GraphNode) -> str:

Callers 1

_node_to_textFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected