histogram

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeFilterCSVFilesToJSON added in v1.4.0

func MergeFilterCSVFilesToJSON(inPaths []string, outPath string, inComma rune, inStripBom bool, perm os.FileMode, andFilter map[string]stringsutil.MatchInfo) error

Types

type DocumentsSet added in v1.4.0

type DocumentsSet struct {
	Meta      DocumentsSetMeta    `json:"meta"`
	Documents []map[string]string `json:"records"`
}

func NewDocumentsSet added in v1.4.0

func NewDocumentsSet() DocumentsSet

func ReadMergeFilterCSVFiles added in v1.4.0

func ReadMergeFilterCSVFiles(inPaths []string, outPath string, inComma rune, inStripBom bool, andFilter map[string]stringsutil.MatchInfo) (DocumentsSet, error)

func (*DocumentsSet) CreateHistogram added in v1.4.0

func (ds *DocumentsSet) CreateHistogram(key string)

func (*DocumentsSet) Inflate added in v1.4.0

func (ds *DocumentsSet) Inflate()

type DocumentsSetMeta added in v1.4.0

type DocumentsSetMeta struct {
	Count      int                   `json:"count"`
	Histograms map[string]*Histogram `json:"histograms"`
}

func NewDocumentsSetMeta added in v1.4.0

func NewDocumentsSetMeta() DocumentsSetMeta

type Histogram

type Histogram struct {
	BinCount      int            `json:"binCount"`
	BinsFrequency map[string]int `json:"binsFrequency"`
}

func NewHistogram

func NewHistogram() *Histogram

func ParseFileCSV added in v1.4.0

func ParseFileCSV(file string, binNameColIdx, binFrequencyColIdx uint) (*Histogram, error)

ParseFileCSV reads a CSV using default settings of `,` separator, header row and BOM to be stripped. If you have other configurations, use `table.ReadFile()` directly and call `HistogramFromTable()`.

func ParseTable added in v1.4.0

func ParseTable(tbl table.Table, binNameColIdx, binFrequencyColIdx uint) (*Histogram, error)

ParseTable parses a `table.Table` to a `Histogram` given a table, binName column index and binFrequency column index. Empty rows are skipped.

func TransformBinNames added in v1.4.0

func TransformBinNames(hist *Histogram, xfFunc func(input string) string) *Histogram

TransformBinNames modifies bin names and returns a new histogram.

func TransformBinNamesByPrefix added in v1.4.0

func TransformBinNamesByPrefix(hist *Histogram, xfMap map[string]string) *Histogram

TransformBinNamesByPrefix modifies bin names and returns a new histogram.

func (*Histogram) Add

func (h *Histogram) Add(bin string, count int)

func (*Histogram) Inflate

func (h *Histogram) Inflate()

type HistogramSet

type HistogramSet struct {
	Meta         HistogramSetMetadata  `json:"meta,omitempty"`
	HistogramMap map[string]*Histogram `json:"histograms"`
}

func NewHistogramSet

func NewHistogramSet() HistogramSet

func (*HistogramSet) Add

func (hs *HistogramSet) Add(name, bin string, count int)

func (*HistogramSet) Inflate

func (hs *HistogramSet) Inflate()

type HistogramSetMetadata

type HistogramSetMetadata struct {
	Names          []string `json:"names,omitempty"`
	NameCount      int      `json:"nameCount,omitempty"`
	UniqueBinCount int      `json:"uniqueBinCount,omitempty"`
}

func NewHistogramSetMetadata

func NewHistogramSetMetadata() HistogramSetMetadata

Jump to

Keyboard shortcuts

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