def is_lyrics(text, artist=None):
 if (not text):
  return False
 badTriggersOcc = []
 nbLines = text.count('\n')
 if (nbLines <= 1):
  log.debug(u"Ignoring too short lyrics '{0}'".format(text))
  return False
 elif (nbLines < 5):
  badTriggersOcc.append('too_short')
 else:
  text = remove_credits(text)
 badTriggers = ['lyrics', 'copyright', 'property', 'links']
 if artist:
  badTriggersOcc += [artist]
 for item in badTriggers:
  badTriggersOcc += ([item] * len(re.findall(('\\W%s\\W' % item), text, re.I)))
 if badTriggersOcc:
  log.debug(u'Bad triggers detected: {0}'.format(badTriggersOcc))
 return (len(badTriggersOcc) < 2)

def is_lyrics ( text , artist = None ) : if ( not text ) : return False badTriggersOcc = [ ] nbLines = text . count ( '\n' ) if ( nbLines <= 1 ) : log . debug ( u"Ignoring too short lyrics '{0}'" . format ( text ) ) return False elif ( nbLines < 5 ) : badTriggersOcc . append ( 'too_short' ) else : text = remove_credits ( text ) badTriggers = [ 'lyrics' , 'copyright' , 'property' , 'links' ] if artist : badTriggersOcc += [ artist ] for item in badTriggers : badTriggersOcc += ( [ item ] * len ( re . findall ( ( '\\W%s\\W' % item ) , text , re . I ) ) ) if badTriggersOcc : log . debug ( u'Bad triggers detected: {0}' . format ( badTriggersOcc ) ) return ( len ( badTriggersOcc ) < 2 )
determine whether the text seems to be valid lyrics .