tableclass

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

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

Classifier is object that classifies the table

func NewClassifier

func NewClassifier(logger logutil.Logger) *Classifier

func (*Classifier) Classify

func (c *Classifier) Classify(t *html.Node) (Type, Reason)

Classify classifies a <table> element as layout or data type, based on the set of heuristics at http://asurkov.blogspot.com/2011/10/data-vs-layout-table.html, with some modifications to suit our distillation needs.

type Reason

type Reason uint
const (
	Unknown Reason = iota
	InsideEditableArea
	RoleTable
	RoleDescendant
	Datatable0
	CaptionTheadTfootColgroupColTh
	AbbrHeadersScope
	OnlyHasAbbr
	More95PercentDocWidth
	Summary
	NestedTable
	LessEq1Row
	LessEq1Col
	MoreEq5Cols
	CellsHaveBorder
	DifferentlyColoredRows
	MoreEq20Rows
	LessEq10Cells
	EmbedObjectAppletIframe
	More90PercentDocHeight
	Default
)

func (Reason) String

func (r Reason) String() string

type Type

type Type uint
const (
	Data Type = iota
	Layout
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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