extract

package
v0.0.0-...-8fa43a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFiles

func CollectFiles(root string) []string

CollectFiles collects all source files from a directory.

func GetNodeIds

func GetNodeIds(extraction *Extraction) []string

GetNodeIds returns the IDs of all nodes in an extraction.

func GetNodeLabels

func GetNodeLabels(extraction *Extraction) []string

GetNodeLabels returns the labels of all nodes in an extraction.

func MakeId

func MakeId(parts ...string) string

MakeId creates a stable node ID from name parts.

func SortNodes

func SortNodes(nodes []Node)

SortNodes sorts nodes by ID for deterministic output.

Types

type Edge

type Edge struct {
	Source     string  `json:"source"`
	Target     string  `json:"target"`
	Relation   string  `json:"relation"`
	Confidence string  `json:"confidence"`
	Weight     float64 `json:"weight"`
}

Edge represents a relationship between nodes.

type Extraction

type Extraction struct {
	Nodes        []Node `json:"nodes"`
	Edges        []Edge `json:"edges"`
	InputTokens  int    `json:"input_tokens"`
	OutputTokens int    `json:"output_tokens"`
}

Extraction represents the result of extracting structured data from a file.

func Extract

func Extract(files []string, root string) *Extraction

Extract runs extraction on multiple files.

func ExtractC

func ExtractC(path string) *Extraction

ExtractC extracts functions and imports from a C file.

func ExtractCSharp

func ExtractCSharp(path string) *Extraction

ExtractCSharp extracts classes, methods, and imports from a C# file using tree-sitter AST parsing.

func ExtractCpp

func ExtractCpp(path string) *Extraction

ExtractCpp extracts classes, methods, functions, and includes from a C++ file using tree-sitter.

func ExtractDart

func ExtractDart(path string) *Extraction

ExtractDart extracts classes, methods, and imports from a Dart file using tree-sitter AST parsing.

func ExtractElixir

func ExtractElixir(path string) *Extraction

ExtractElixir extracts modules, functions, and imports from an Elixir file using tree-sitter AST parsing.

func ExtractElm

func ExtractElm(path string) *Extraction

ExtractElm extracts functions, types, and imports from an Elm file using tree-sitter AST parsing.

func ExtractGo

func ExtractGo(path string) *Extraction

ExtractGo extracts functions, methods, types, and imports from a Go file.

func ExtractHaskell

func ExtractHaskell(path string) *Extraction

ExtractHaskell extracts functions, types, and imports from a Haskell file.

func ExtractJava

func ExtractJava(path string) *Extraction

ExtractJava extracts classes, methods, and imports from a Java file.

func ExtractJavaScript

func ExtractJavaScript(path string) *Extraction

ExtractJavaScript extracts functions, classes, and imports from a JavaScript/TypeScript file.

func ExtractJulia

func ExtractJulia(path string) *Extraction

ExtractJulia extracts modules, functions, and imports from a Julia file using tree-sitter AST parsing.

func ExtractKotlin

func ExtractKotlin(path string) *Extraction

ExtractKotlin extracts classes, methods, and imports from a Kotlin file using tree-sitter AST parsing.

func ExtractLua

func ExtractLua(path string) *Extraction

ExtractLua extracts functions, methods, and imports from a Lua file.

func ExtractObjectiveC

func ExtractObjectiveC(path string) *Extraction

ExtractObjectiveC extracts classes, methods, and imports from an Objective-C file using tree-sitter AST parsing.

func ExtractPHP

func ExtractPHP(path string) *Extraction

ExtractPHP extracts classes, methods, and imports from a PHP file.

func ExtractPowerShell

func ExtractPowerShell(path string) *Extraction

ExtractPowerShell extracts functions, classes, and imports from a PowerShell file using tree-sitter AST parsing.

func ExtractPython

func ExtractPython(path string) *Extraction

ExtractPython extracts classes, functions, imports, and calls from a Python file using tree-sitter.

func ExtractR

func ExtractR(path string) *Extraction

ExtractR extracts functions, methods, and imports from an R file using tree-sitter AST parsing.

func ExtractRuby

func ExtractRuby(path string) *Extraction

ExtractRuby extracts classes, methods, and imports from a Ruby file.

func ExtractRust

func ExtractRust(path string) *Extraction

ExtractRust extracts structs, functions, and imports from a Rust file.

func ExtractScala

func ExtractScala(path string) *Extraction

ExtractScala extracts classes, methods, and imports from a Scala file using tree-sitter AST parsing.

func ExtractSwift

func ExtractSwift(path string) *Extraction

ExtractSwift extracts classes, methods, and imports from a Swift file using tree-sitter AST parsing.

func ExtractZig

func ExtractZig(path string) *Extraction

ExtractZig extracts structs, functions, and imports from a Zig file.

type Node

type Node struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	Type     string `json:"type,omitempty"`
	File     string `json:"source_file"`
	Location string `json:"source_location"`
}

Node represents a node in the knowledge graph.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL