Documentation
¶
Index ¶
- func AddFileToDirectory(root *Directory, filePath string)
- func BasicEstimateTokenFromChars(charCount int) int
- func CountFilesRecursive(dir *Directory) int
- func GenerateDotOutput(root *Directory) string
- func GenerateJSONTreeOutput(root *Directory) string
- func GenerateTreeOutput(root *Directory) string
- func GenerateXMLTreeOutput(root *Directory) string
- func SortByFloat64(arr []Float64Sortable, ascending bool)
- func SortByInt64(arr []Int64Sortable, ascending bool)
- func SortStrings(arr []string)
- func SortStringsHeap(arr []string)
- type Directory
- type Float64Sortable
- type Int64Sortable
- type TokenEstimator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileToDirectory ¶
AddFileToDirectory adds a file to the directory structure
func BasicEstimateTokenFromChars ¶
BasicEstimateTokenFromChars provides a simple estimate of tokens based on characters
func CountFilesRecursive ¶
CountFilesRecursive counts the number of files in a directory and its subdirectories
func GenerateDotOutput ¶
GenerateDotOutput generates a DOT (Graphviz) representation of the directory tree
func GenerateJSONTreeOutput ¶
GenerateJSONTreeOutput generates a JSON representation of the directory tree
func GenerateTreeOutput ¶
GenerateTreeOutput generates a string representation of the directory tree
func GenerateXMLTreeOutput ¶
GenerateXMLTreeOutput generates an XML representation of the directory tree
func SortByFloat64 ¶ added in v1.0.5
func SortByFloat64(arr []Float64Sortable, ascending bool)
SortByFloat64 sorts a slice of Float64Sortable in-place using quicksort
func SortByInt64 ¶ added in v1.0.5
func SortByInt64(arr []Int64Sortable, ascending bool)
SortByInt64 sorts a slice of Int64Sortable in-place using quicksort
func SortStrings ¶ added in v1.0.5
func SortStrings(arr []string)
SortStrings sorts a slice of strings in-place using quicksort
func SortStringsHeap ¶ added in v1.0.5
func SortStringsHeap(arr []string)
SortStringsHeap sorts strings using heap sort
Types ¶
type Directory ¶
Directory represents a directory in the file system
func GetOrCreateDirectory ¶
GetOrCreateDirectory gets or creates a directory at the specified path
func NewDirectory ¶
NewDirectory creates a new directory structure
type Float64Sortable ¶ added in v1.0.5
type Float64Sortable struct {
Key float64
Value interface{}
}
SortFloat64Slice sorts a slice with associated data by float64 values
type Int64Sortable ¶ added in v1.0.5
type Int64Sortable struct {
Key int64
Value interface{}
}
SortInt64Slice sorts a slice with associated data by int64 values
type TokenEstimator ¶
type TokenEstimator struct {
// Adjustment factors for different categories of text
CodeFactor float64
TextFactor float64
SpecialChars map[rune]float64 // Special characters and their token weight
}
TokenEstimator estimates token counts from text
func NewTokenEstimator ¶
func NewTokenEstimator() *TokenEstimator
NewTokenEstimator creates a new token estimator with default settings
func (*TokenEstimator) EstimateFileTokens ¶
func (te *TokenEstimator) EstimateFileTokens(filePath string, isCode bool) (int, error)
EstimateFileTokens estimates the number of tokens in a file
func (*TokenEstimator) EstimateTokens ¶
func (te *TokenEstimator) EstimateTokens(text string, isCode bool) int
EstimateTokens estimates the number of tokens in the given text The isCode parameter indicates whether the text is code or natural language