scorer

package
v0.0.0-...-71af719 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageAreaScorer

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

ImageAreaScorer uses image area (length*width) as its heuristic. Unfortunately to do that we need to compute CSS which is impossible in Go, so this scorer do nothing. NEED-COMPUTE-CSS.

func NewImageAreaScorer

func NewImageAreaScorer(maxScore, minArea, maxArea int) *ImageAreaScorer

NewImageAreaScorer returns and initiates the ImageAreaScorer.

func (*ImageAreaScorer) GetImageScore

func (s *ImageAreaScorer) GetImageScore(_ *html.Node) int

func (*ImageAreaScorer) GetMaxScore

func (s *ImageAreaScorer) GetMaxScore() int

type ImageDomDistanceScorer

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

ImageDomDistanceScorer uses DOM distance as its heuristic.

func NewImageDomDistanceScorer

func NewImageDomDistanceScorer(maxScore int, firstContent *html.Node) *ImageDomDistanceScorer

NewImageDomDistanceScorer returns and initiates the ImageDomDistanceScorer.

func (*ImageDomDistanceScorer) GetImageScore

func (s *ImageDomDistanceScorer) GetImageScore(node *html.Node) int

func (*ImageDomDistanceScorer) GetMaxScore

func (s *ImageDomDistanceScorer) GetMaxScore() int

type ImageHasFigureScorer

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

ImageHasFigureScorer scores based on if the image has a "figure" node as an ancestor.

func NewImageHasFigureScorer

func NewImageHasFigureScorer(maxScore int) *ImageHasFigureScorer

NewImageHasFigureScorer returns and initiates the ImageHasFigureScorer.

func (*ImageHasFigureScorer) GetImageScore

func (s *ImageHasFigureScorer) GetImageScore(node *html.Node) int

func (*ImageHasFigureScorer) GetMaxScore

func (s *ImageHasFigureScorer) GetMaxScore() int

type ImageRatioScorer

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

ImageRatioScorer uses image ratio (length/width) as its heuristic. Unfortunately to do that we need to compute CSS which is impossible in Go, so this scorer do nothing. NEED-COMPUTE-CSS.

func NewImageRatioScorer

func NewImageRatioScorer(maxScore int) *ImageRatioScorer

NewImageRatioScorer returns and initiates the ImageRatioScorer.

func (*ImageRatioScorer) GetImageScore

func (s *ImageRatioScorer) GetImageScore(_ *html.Node) int

func (*ImageRatioScorer) GetMaxScore

func (s *ImageRatioScorer) GetMaxScore() int

type ImageScorer

type ImageScorer interface {
	// GetImageScore returns a particular image a score based on the heuristic
	// implemented in this ImageScorer and what the max score is set to.
	GetImageScore(e *html.Node) int

	// GetMaxScore returns the maximum possible score that this ImageScorer can return.
	GetMaxScore() int
}

ImageScorer is used to represent a single heuristic used in image extraction. The provided image will be given a score based on the heuristic and a max score.

Jump to

Keyboard shortcuts

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