docs: def detect(self, code) :
  		""" Detect language with code
  		"""
  		
  		keywords = KeywordFetcher.fetch( code )
  		probabilities = {}
  
  		for keyword in keywords :
  			if keyword not in self.trained_set['keywords'] :
  				continue
  
  			data = self.trained_set['keywords'][keyword]
  			p_avg = sum(data.values()) / len(data) # Average probability of all languages
  
  			for language, probability in data.items() :
  				# By Naïve Bayes Classification
  				p = probability / p_avg
  
  				probabilities[ language ] = probabilities.get(language, 0) + math.log(1 + p)
  
  
  		for pattern, data in self.trained_set['patterns'].items() :
  			matcher = PatternMatcher(pattern)
  			p0 = matcher.getratio(code)
  			
  			for language, p_avg in data.items() :
  				if language not in probabilities :
  					continue
  
  				p = 1 - abs(p_avg - p0)
  				probabilities[ language ] *= p
  				
  
  		# Convert `log` operated probability to percentile
  		sum_val = 0
  		for language, p in probabilities.items() :
  			sum_val += math.pow(math.e / 2, p)
  
  		for language, p in probabilities.items() :
  			probabilities[language] = math.pow(math.e / 2, p) / sum_val * 100
  
  		return sorted(probabilities.items(), key=lambda a: a[1], reverse=True)