tagify

package module
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

README

Tagify

Build Status Go Report Card Coverage GoDoc Mentioned in Awesome Go

Gets STDIN, file or HTTP address as an input and returns ordered list of most frequent words as an output.

Visit playground here:

ZoomIO Tagify

Example, "tagify" this repository (with the limit of 3 tags):

$ tagify -s=https://github.com/zoomio/tagify -l=3
frequent address apache

In code (see cmd/cli/cli.go).

Use -no-stop flag to disable stop-words filtering (github.com/zoomio/stopwords).

Installation

Binary
  • download latest release for corrseponding OS (Darwin or Linux) from Releases
  • make binary executable: chmod +x <binary>
  • put executable binary under your bin directory, e.g. (assuming ~/bin is in your PATH): mv <binary> $HOME/bin/<binary>.
Go dependency
go get -u github.com/zoomio/tagify/...

Changelog

See CHANGELOG.md

Contributing

See CONTRIBUTING.md

License

Released under the Apache License 2.0.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Source sets target source.
	Source = func(source string) Option {
		return func(c *config) {
			c.source = source
		}
	}

	// Query sets CSS query for the target.
	Query = func(query string) Option {
		return func(c *config) {
			c.query = query
		}
	}

	// TargetType sets content type of the target.
	TargetType = func(contentType ContentType) Option {
		return func(c *config) {
			c.contentType = contentType
		}
	}

	// Limit sets cthe limit of tags for the target.
	Limit = func(limit int) Option {
		return func(c *config) {
			c.limit = limit
		}
	}

	// Verbose enables high verbosity.
	Verbose = func(verbose bool) Option {
		return func(c *config) {
			c.verbose = verbose
		}
	}

	// NoStopWords enables stop-words exclusion from the output.
	NoStopWords = func(noStopWords bool) Option {
		return func(c *config) {
			c.noStopWords = noStopWords
		}
	}
)

Functions

func GetTags deprecated

func GetTags(ctx context.Context, source string, contentType ContentType, limit int, verbose, noStopWords bool) ([]*processor.Tag, error)

GetTags produces slice of tags ordered by frequency and limited by limit.

Deprecated: use tagify#Run instead.

func GetTagsFromString added in v0.1.0

func GetTagsFromString(input string, contentType ContentType, limit int, verbose, noStopWords bool) ([]*processor.Tag, error)

GetTagsFromString produces slice of tags ordered by frequency and limited by limit.

func GetTagsWithQuery deprecated added in v0.17.0

func GetTagsWithQuery(ctx context.Context, source, query string, contentType ContentType, limit int,
	verbose, noStopWords bool) ([]*processor.Tag, error)

GetTagsWithQuery produces slice of tags from "source" narrowed down to a CSS "query" ordered by frequency and limited by limit.

Deprecated: use tagify#Run instead.

func Run added in v0.18.0

func Run(ctx context.Context, options ...Option) ([]*processor.Tag, error)

Run produces slice of tags ordered by frequency.

func ToStrings added in v0.4.0

func ToStrings(items []*processor.Tag) []string

ToStrings transforms a list of tags into a list of strings.

Types

type ContentType added in v0.2.0

type ContentType byte

ContentType ...

const (
	Unknown ContentType = iota
	Text
	HTML
)

Content types

func ContentTypeOf added in v0.2.0

func ContentTypeOf(contentType string) ContentType

ContentTypeOf returns ContentType based on string value.

func (ContentType) String added in v0.2.0

func (contentType ContentType) String() string

String ...

type Option added in v0.18.0

type Option func(*config)

Option allows to customise configuration.

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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