// Splits the given []byte using the given regexp, then returns a slice // containing a Feature constructed from each piece matched by the regexp func getFeatures(b []byte, r *regexp.Regexp) []Feature { words := r.FindAll(b, -1) features := make([]Feature, len(words)) for i, w := range words { features[i] = NewFeature(w) } return features }