<commit_before>### Correcting falsely assigned enharmonics in sheet music

import freqs
from music21 import *

table = freqs.table

def correct_enharm(filename): # might add more arguments for control
	'''
	Open and scan through music file, and replace accidentals with likeliest enharmonic equivalents.
	'''
	pass

def likeliest_enharm(n, np, nn, c, cp, cn, k):
	'''
	Estimate the likeliest enharmonic equivalent of the current note based on the previous and next notes, as well as
	the previous, current and next chords.
	'''
	# P(n = e | np, nn, c, cp, cn, k) = Z * P(n = e | np, cp, c, k) * P(nn | n = e, c, cn, k)
	n1 = enharm_eqv(n)
	# problem: what if np, nn are also ambiguous? condition across enharmonics, in a function replacing tprob
	if table.tprob(n1, np, cp, c, k) * table.tprob(nn, n1, c, cn, k) >
	   table.tprob( n, np, cp, c, k) * table.tprob(nn,  n, c, cn, k):
		return n1
	return n<commit_msg>Getting enharmonic equivalent of pitch<commit_after>### Correcting falsely assigned enharmonics in sheet music

import freqs
from music21 import *

table = freqs.table

def correct_enharm(filename): # might add more arguments for control
	'''
	Open and scan through music file, and replace accidentals with likeliest enharmonic equivalents.
	'''
	pass

def likeliest_enharm(n, np, nn, c, cp, cn, k):
	'''
	Estimate the likeliest enharmonic equivalent of the current note based on the previous and next notes, as well as
	the previous, current and next chords.
	'''
	# P(n = e | np, nn, c, cp, cn, k) = Z * P(n = e | np, cp, c, k) * P(nn | n = e, c, cn, k)
	n1 = n.getEnharmonic() # n is a pitch
	# problem: what if np, nn are also ambiguous? condition across enharmonics, in a function replacing tprob
	if table.tprob(n1, np, cp, c, k) * table.tprob(nn, n1, c, cn, k) >
	   table.tprob( n, np, cp, c, k) * table.tprob(nn,  n, c, cn, k):
		return n1
	return n
{'fraction_non_alphanumeric': 0.11431623931623931, 'fraction_numerical': 0.00641025641025641, 'mean_word_length': 3.864935064935065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2301522', 'n_tokens_mistral': 696, 'n_tokens_neox': 675, 'n_words': 277}