patterns

package
v1.0.1-0...-6123b81 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package patterns provides regular expressions and pattern-matching utils.

Index

Constants

This section is empty.

Variables

View Source
var AePattern = regexp.MustCompile(`Arts\s?&\s?Entertainment|A&?E`)
View Source
var UnwantedFilePattern = regexp.MustCompile(`(?i)worldbeat|survey|newsbeat|spookbeat|sportsbeat|playlist|calendar|\[IGNORE\]|corrections|timeline`)

Functions

func BylineComponents

func BylineComponents(byline string) []string

BylineComponents extracts the components of a byline crucial to parsing (e.g. ampersands, words/names, commas). It returns a slice of the components.

func CleanByline

func CleanByline(byline string) string

CleanByline rids a byline of its paddings (e.g. "By:"). It returns the cleaned byline.

func CleanFocus

func CleanFocus(focusSentence string) string

CleanFocus rids a focus sentence of its paddings (e.g. "Focus Sentence:"). It returns the cleaned focus sentence.

func CleanName

func CleanName(name string) string

CleanName rids a name of nicknames and redundant spaces (e.g. "Ying Zi (Jessy) Mei"). It returns the cleaned name.

func CleanOutquote

func CleanOutquote(outquote string) string

CleanOutquote rids an outquote of its paddings (e.g. "Outquote(s):"). It returns the cleaned outquote.

func CleanTitle

func CleanTitle(title string) string

CleanTitle rids a title of its paddings (e.g. "Title:"). It returns the cleaned title.

func DepartmentName

func DepartmentName(marker string) string

DepartmentName extracts the department name of a slug line. It returns the department name.

func DriveID

func DriveID(url string) (id string, err error)

DriveID extracts the Drive ID of a URL of a Google Apps Script. It returns the ID.

func HrefCapture

func HrefCapture(html string) string

HrefCapture extracts the href of an a tag in HTML. It returns the href.

func IsAE

func IsAE(str string) bool

IsAE determines whether a string represents the Arts & Entertainment department. It returns true or false.

func IsByline

func IsByline(str string) bool

IsByline determines whether a string is a byline. It returns true or false.

func IsDepartmentMarker

func IsDepartmentMarker(str string) bool

IsDepartmentMarker determines whether a string marks the department. (e.g. "The Spectator/Opinions/Issue 10")

func IsFileUnwanted

func IsFileUnwanted(filename string) bool

IsFileUnwanted determines whether the name of a Drive file contains an unwanted article.

func IsFocus

func IsFocus(str string) bool

IsFocus determines whether a string is a focus sentence. It returns true or false.

func IsOutquote

func IsOutquote(str string) bool

IsOutquote determines whether a string is an outquote. It returns true or false.

func IsSlugMember

func IsSlugMember(str string) bool

IsSlugMember determines whether a string is a member of an article slug. It returns true or false.

func NameVariables

func NameVariables(name string) []string

NameVariables splits a name of variable length into a first name and a last name. It returns a slice with the first element as the first name and the second element as the last name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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