<commit_before>SELECT
rootnote.name as root,
cp.name as pattern,
total.count as chordsize,
CAST(match.count AS FLOAT)/CAST(total.count AS FLOAT) as precision
FROM (
	SELECT
	chord.id as c_id,
	chord.root_an_id,
	chord.cp_id,
	COUNT(cn.an_id)
	FROM
	chord
	JOIN
	chordnote as cn
	ON cn.c_id = chord.id
	JOIN
	chordpattern as cp
	ON cp.id = chord.cp_id
	JOIN absnote as rootnote
	ON rootnote.id = chord.root_an_id
	JOIN absnote
	ON absnote.id = cn.an_id
	WHERE
	absnote.name = 'C'
	OR
	absnote.name = 'E'
	OR
	absnote.name = 'G'
	GROUP BY chord.id
	HAVING COUNT(cn.an_id) = 3
) AS match
JOIN (
	SELECT
	chord.id as c_id,
	COUNT(cn.an_id)
	FROM
	chord
	JOIN
	chordnote as cn
	ON cn.c_id = chord.id
	GROUP BY chord.id
) as total
ON total.c_id = match.c_id
JOIN
absnote as rootnote
ON match.root_an_id = rootnote.id
JOIN
chordpattern as cp
ON cp.id = match.cp_id
ORDER BY CAST(match.count AS FLOAT)/CAST(total.count AS FLOAT) DESC
--ORDER BY match.count DESC, total.count ASC
LIMIT 20;<commit_msg>Added comments<commit_after>SELECT
rootnote.name as root,
cp.name as pattern,
total.count as chordsize,
CAST(match.count AS FLOAT)/CAST(total.count AS FLOAT) as precision
FROM (
	SELECT
	chord.id as c_id,
	chord.root_an_id,
	chord.cp_id,
	COUNT(cn.an_id)
	FROM
	chord
	JOIN
	chordnote as cn
	ON cn.c_id = chord.id
	JOIN
	chordpattern as cp
	ON cp.id = chord.cp_id
	JOIN absnote as rootnote
	ON rootnote.id = chord.root_an_id
	JOIN absnote
	ON absnote.id = cn.an_id
	WHERE
	-- BEGIN INPUT NOTES
	absnote.name = 'C'
	OR
	absnote.name = 'E'
	OR
	absnote.name = 'G'
	-- END INPUT NOTES
	GROUP BY chord.id
	HAVING COUNT(cn.an_id) = 3
) AS match
JOIN (
	SELECT
	chord.id as c_id,
	COUNT(cn.an_id)
	FROM
	chord
	JOIN
	chordnote as cn
	ON cn.c_id = chord.id
	GROUP BY chord.id
) as total
ON total.c_id = match.c_id
JOIN
absnote as rootnote
ON match.root_an_id = rootnote.id
JOIN
chordpattern as cp
ON cp.id = match.cp_id
ORDER BY CAST(match.count AS FLOAT)/CAST(total.count AS FLOAT) DESC
--ORDER BY match.count DESC, total.count ASC
LIMIT 20;
{'fraction_non_alphanumeric': 0.0897878638381845, 'fraction_numerical': 0.0029600394671928957, 'mean_word_length': 3.588235294117647, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6315151', 'n_tokens_mistral': 919, 'n_tokens_neox': 893, 'n_words': 252}