<commit_before>package robotjazz

import (
	"errors"
	"log"
	//"strings"
	"github.com/SudoQ/robotjazz/chord"
	"github.com/SudoQ/robotjazz/model"
	"github.com/SudoQ/robotjazz/data"
)

/*
func main() {
	fmt.Println("Robot Jazz v0.1")
	m := model.New()
	m.Load("resources/chords-v1.csv")
	dataItem, _ := m.Classify([]float64{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0})

	// Prints top ten most relevant chords
	for i := 0; i < MinInt(len(dataItem.ClosestCentroids), 10); i++ {
		fmt.Println(dataItem.ClosestCentroids[i].Tag)
	}
}
*/
func MinInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}

var mainModel *model.Model

func init() {
	mainModel = model.New()
	// TODO read env for root dir of robot jazz project
	mainModel.Load("resources/chords-v1.csv")
}

func GetMatchingChords(notes []float64) ([]*chord.Chord, error) {
	if len(notes) != 12 {
		return nil, errors.New("First input argument must be a float64 slice of length 12")
	}
	dataItem, err := mainModel.Classify(notes)
	if err != nil {
		return nil, err
	}<commit_msg>Removed old comments<commit_after>package robotjazz

import (
	"errors"
	"log"
	"github.com/SudoQ/robotjazz/chord"
	"github.com/SudoQ/robotjazz/model"
	"github.com/SudoQ/robotjazz/data"
)

func MinInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}

var mainModel *model.Model

func init() {
	mainModel = model.New()
	// TODO read env for root dir of robot jazz project
	mainModel.Load("resources/chords-v1.csv")
}

func GetMatchingChords(notes []float64) ([]*chord.Chord, error) {
	if len(notes) != 12 {
		return nil, errors.New("First input argument must be a float64 slice of length 12")
	}
	dataItem, err := mainModel.Classify(notes)
	if err != nil {
		return nil, err
	}
{'fraction_non_alphanumeric': 0.15473441108545036, 'fraction_numerical': 0.028868360277136258, 'mean_word_length': 3.760989010989011, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1489561', 'n_tokens_mistral': 750, 'n_tokens_neox': 711, 'n_words': 174}