Documentation
¶
Index ¶
- Variables
- func CompareAlbumTitles(a, b string) (score, scrubbedScore float64)
- func CompareArtistName(a, b string) (score, scrubbedScore float64)
- func CompareArtistNames(a, b []string) (score, scrubbedScore float64)
- func CompareDurations(a, b int) (score, scrubbedScore float64)
- func CompareTrackTitles(a, b string) (score, scrubbedScore float64)
- func DurationFromString(durStr string) time.Duration
- func DurationFromStringInSeconds(durStr string) int
- func Scrub(original string) string
- func ScrubAlbumTitle(original string) string
- func ScrubArtistName(original string) string
- func ScrubTrackTitle(original string) string
- type ReleaseDate
- func (date ReleaseDate) MarshalJSON() ([]byte, error)
- func (date *ReleaseDate) Scan(value interface{}) error
- func (date *ReleaseDate) ScanString(s string)
- func (date ReleaseDate) String() string
- func (date *ReleaseDate) UnmarshalJSON(b []byte) (err error)
- func (date *ReleaseDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (date ReleaseDate) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
var AlbumTitleIgnoredPhrases = []*regexp.Regexp{ regexp.MustCompile("(?i)\\s+(EP|LP)$"), regexp.MustCompile("(?i)\\s+\\([^)]*remaster[^)]*\\)$"), regexp.MustCompile("(?i)\\s+\\([^)]*deluxe[^)]*\\)$"), regexp.MustCompile("(?i)\\s+\\([^)]*version[^)]*\\)$"), regexp.MustCompile("(?i)parental\\s*advisory"), }
AlbumTitleIgnoredPhrases is the arraty of regular expressions which will be stripped from album titles during the scrubbing process
var TrackTitleIgnoredPhrases = []*regexp.Regexp{ regexp.MustCompile("(?i)\\([^)]*remaster[^)]*\\)$"), regexp.MustCompile("(?i)\\([^)]*version[^)]*\\)$"), regexp.MustCompile("(?i)\\([^)]*mix[^)]*\\)$"), regexp.MustCompile("(?i)\\([^)]*live[^)]*\\)$"), regexp.MustCompile("(?i)parental\\s*advisory"), regexp.MustCompile("(?i)(radio|deluxe|album|live|expanded)\\s*(edition|version|release|edit)?"), }
TrackTitleIgnoredPhrases is the array of regular expressions which will be stripped from track titles during the scrubbing process
Functions ¶
func CompareAlbumTitles ¶
CompareAlbumTitles calculates the similarity score (100 represents a perfect match) between the two submitted album titles. Two scores are returned. The first is the direct comparison, the second is the score after scrubbing noise words.
func CompareArtistName ¶
CompareArtistName calculates the similarity score (100 represents a perfect match) between the two submitted artist names. Two scores are returned. The first is the direct comparison score. The second is the score after scrubbing noise words.
func CompareArtistNames ¶
CompareArtistNames calculates the similarity score (100 represents a perfect match) between arrays of artist names. Each artist in the first slice is compared with each artist in the second. The best scores for each artist are kept, and the average match of all artists is returned.
func CompareDurations ¶
CompareDurations returns a score for the similarity of the durations of the two songs
func CompareTrackTitles ¶
CompareTrackTitles calculates the similarity score (100 represents a perfect match) between the two submitted track titles. Two scores are returned. The first is the direct comparison, the second is the score after scrubbing noise words.
func DurationFromString ¶
DurationFromString converts a song length in string format (e.g. 00:00) and returns a time.Duration.
func DurationFromStringInSeconds ¶
DurationFromStringInSeconds converts a song length in string format (e.g. 00:00) and returns an integer representing the song's length in seconds.
func Scrub ¶
Scrub removes all punctuation and lowercases the word. If the original string was all punctuation, then it is returned to avoid losing vital information (there is a band called !!!, for example).
func ScrubAlbumTitle ¶
ScrubAlbumTitle scrubs noise words for album titles, removes punctuation and lowercases
func ScrubArtistName ¶
ScrubArtistName scrubs noise words for artist names, removes punctuation and lowercases values
func ScrubTrackTitle ¶
ScrubTrackTitle scrubs noise words for song titles, removes punctuation and lowercases
Types ¶
type ReleaseDate ¶
ReleaseDate wraps a time.Time with application-specific XML and JSON Marshaling, and implements sql.Valuer
func DateFromString ¶
func DateFromString(str string) ReleaseDate
DateFromString creates a Date by parsing the supplied string
func (ReleaseDate) MarshalJSON ¶
func (date ReleaseDate) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaler
func (*ReleaseDate) Scan ¶
func (date *ReleaseDate) Scan(value interface{}) error
Scan implements the database/sql.Scanner interface
func (*ReleaseDate) ScanString ¶
func (date *ReleaseDate) ScanString(s string)
ScanString is a helper for Scan() to handle string-based input parsing to time.Time.
func (ReleaseDate) String ¶
func (date ReleaseDate) String() string
func (*ReleaseDate) UnmarshalJSON ¶
func (date *ReleaseDate) UnmarshalJSON(b []byte) (err error)
UnmarshalJSON implements encoding/json.Unmarshaler
func (*ReleaseDate) UnmarshalXML ¶
func (date *ReleaseDate) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements encoding/xml.Unmarshaler