merge_machine/preprocess_fields_v3.py
def lower_or_not(token, keepAcronyms, keepInitialized = False):
	''' Set keepAcronyms to true in order to improve precision (e.g. a CAT scan will not be matched by a kitty). '''
	if keepAcronyms and len(token) >= MIN_ACRO_SIZE and len(token) <= MAX_ACRO_SIZE and is_acronym_token(token):
		return token
	if keepInitialized:
		m = re.search("([A-Z][0-9]+)[^'a-zA-Z].*", token)
		if m:
			toKeep = m.group(0)
			return toKeep + lower_or_not(token[len(toKeep):], keepAcronyms, keepInitialized)
	return token.lower()
 Set keepAcronyms to true in order to improve precision (e.g. a CAT scan will not be matched by a kitty). 
Set keepAcronyms to true in order to improve precision .
Set keepAcronyms to true in order to improve precision .
def lower_or_not(token, keepAcronyms, keepInitialized = False):
	if keepAcronyms and len(token) >= MIN_ACRO_SIZE and len(token) <= MAX_ACRO_SIZE and is_acronym_token(token):
		return token
	if keepInitialized:
		m = re.search("([A-Z][0-9]+)[^'a-zA-Z].*", token)
		if m:
			toKeep = m.group(0)
			return toKeep + lower_or_not(token[len(toKeep):], keepAcronyms, keepInitialized)
	return token.lower()
def lower_or_not ( token , keepAcronyms , keepInitialized = False ) : if keepAcronyms and len ( token ) >= MIN_ACRO_SIZE and len ( token ) <= MAX_ACRO_SIZE and is_acronym_token ( token ) : return token if keepInitialized : m = re . search ( "([A-Z][0-9]+)[^'a-zA-Z].*" , token ) if m : toKeep = m . group ( 0 ) return toKeep + lower_or_not ( token [ len ( toKeep ) : ] , keepAcronyms , keepInitialized ) return token . lower ( )
Set keepAcronyms to true in order to improve precision (e.g.
Set keepAcronyms to true in order to improve precision ( e . g .
''' Set keepAcronyms to true in order to improve precision (e.g. a CAT scan will not be matched by a kitty). '''
token
keepAcronyms
keepInitialized