ncdsearch

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package ncdsearch contains a basic golang re-implementation of the tool "NCDSearch" by Takashi Ishio, et al. https://github.com/takashi-ishio/NCDSearch

Details may differ.

Index

Constants

View Source
const DefaultFilterThreshold = 0.5
View Source
const DefaultOverlapNGram = 5
View Source
const DefaultSearchThreshold = 0.5
View Source
const DefaultWindowSizeMultiplier = 1.2

Variables

This section is empty.

Functions

func DefaultTokenizeFunc

func DefaultTokenizeFunc(s []byte) [][]byte

Types

type Clone

type Clone struct {
	Filename  string
	StartLine int
	EndLine   int
	KBest     int
	Distance  float64
}
func Search(
	ctx context.Context,
	queriesTree domain.Searcher,
	queries []*Query,
	searchTree domain.Searcher,
	matcher *domain.MatcherRules,
	options ...ConfigFunc,
) ([]*Clone, error)

type ConfigFunc

type ConfigFunc func(c *config)

func WithFilterThreshold

func WithFilterThreshold(filterThreshold float64) ConfigFunc

func WithOverlapNGram

func WithOverlapNGram(nGram int) ConfigFunc

func WithSearchThreshold

func WithSearchThreshold(searchThreshold float64) ConfigFunc

func WithTokenizeFunc

func WithTokenizeFunc(tokenize TokenizeFunc) ConfigFunc

func WithWindowSizeMultiplier

func WithWindowSizeMultiplier(windowSizeMult float64) ConfigFunc

type Query added in v0.7.1

type Query struct {
	Filename     string
	StartL, EndL int
	// contains filtered or unexported fields
}

type TokenizeFunc

type TokenizeFunc = func(s []byte) [][]byte

Jump to

Keyboard shortcuts

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