guesser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsReliable

func IsReliable(confidences []float64) bool

IsReliable returns true if the prediction is considered "reliable". It is considered reliable if the probability of the predicted language is higher than 2 standard deviations from the mean. Original: https://github.com/yoeo/guesslang/blob/42ec63776777e1bdce2d72f51710c6634e36e00c/guesslang/guess.py#L157-L165

Types

type Answer

type Answer struct {
	Predictions []Prediction
	Reliable    bool
}

Answer is the result of a guesslang model execution, also providing whether or not the answer is considered reliable.

type Guesser

type Guesser struct {
	// contains filtered or unexported fields
}

func New

func New() (g *Guesser, err error)

New initializes a guesslang model. It will write the TensorFlow SavedModel temporarily to disk, then load it.

func (*Guesser) Guess

func (g *Guesser) Guess(snippet string) (a *Answer, err error)

Guess executes the guesslang model on a code snippet, providing sorted confidences for all of the supported languages and will also provide whether or not the answer is arbitrarily reliable.

type Prediction

type Prediction struct {
	Confidence float64
	Language   string
}

Prediction is a single language prediction, including the confidence and the language.

Jump to

Keyboard shortcuts

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