tagify

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

Tagify

Build Status Go Report Card

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

Example, get 10 most frequent words from StackOverflow main page:

$ tagify -s=https://stackoverflow.com -l=10
application using page add file server run ionic local error

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

...
tags, _ := tagify.GetTags("https://stackoverflow.com", tagify.HTML, 10, false)
println(strings.Join(tags, " "))
...

Use -no-stop flag todisable stop-words filtering (processor/stopwords.go).

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

This section is empty.

Functions

func GetTags

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

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

func GetTagsFromString added in v0.1.0

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

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

func Init added in v0.2.0

func Init() error

Init initializes Tagify.

func ToStrings added in v0.4.0

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

ToStrings ...

Types

type ContentType added in v0.2.0

type ContentType int

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 In added in v0.2.0

type In struct {
	ContentType
	// contains filtered or unexported fields
}

In - Input. This struct provides methods for reading strings and numbers from standard input, file input, URLs, and sockets.

func NewIn added in v0.2.0

func NewIn(name string) (In, error)

NewIn initializes an input stream from STDIN, file or web page.

name - the filename or web page name, reads from STDIN if name is empty. Panics on errors.

func NewInFromString added in v0.2.0

func NewInFromString(input string, contentType ContentType) In

NewInFromString ...

func (*In) ReadAllLines added in v0.4.0

func (in *In) ReadAllLines() ([]string, error)

ReadAllLines provides slice of lines from input.

func (*In) ReadAllStrings added in v0.2.0

func (in *In) ReadAllStrings() ([]string, error)

ReadAllStrings provides slice of strings from input split by white space.

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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