title: ValueError: A ELE probability distribution must have at least one bin
body: <p>I am trying to classify the sentiments of the tweets using Naiive Bayes Classifier. So when I run the below code i get this error, </p>
  
  <p>ValueError: A ELE probability distribution must have at least one bin.</p>
  
  <p>The code is as follows</p>
  
  <pre><code>import re,nltk
  
  # start process_tweet
  def processTweet(tweet):
      # process the tweets
  
      # Convert to lower case
      tweet = tweet.lower()
      # Convert www.* or https?://* to URL
      tweet = re.sub('((www\.[^\s]+)|(https?://[^\s]+))', 'URL', tweet)
      # Convert @username to AT_USER
      tweet = re.sub('@[^\s]+', 'AT_USER', tweet)
      # Remove additional white spaces
      tweet = re.sub('[\s]+', ' ', tweet)
      # Replace #word with word
      tweet = re.sub(r'#([^\s]+)', r'\1', tweet)
      # trim
      tweet = tweet.strip('\'"')
      return tweet
  
  
  # end
  # Read the tweets one by one and process it
  fp = open('/home/ashish/PyCharm_proj/twitter_sentiment/data/sampleData.txt', 'r')
  
  line = fp.readline()
  print "Processed tweets\n"
  while line:
      processedTweet = processTweet(line)
      print processedTweet
      line = fp.readline()
  # end loop
  
  #start getfeatureVector
  def getFeatureVector(tweet):
      featureVector = []
      #split tweet into words
      words = tweet.split()
      for w in words:
          #replace two or more with two occurrences
          w = replaceTwoOrMore(w)
          #strip punctuation
          w = w.strip('\'"?,.')
          #check if the word stats with an alphabet
          val = re.search(r"^[a-zA-Z][a-zA-Z0-9]*$", w)
          #ignore if it is a stop word
          if(w in stopWords or val is None):
              continue
          else:
              featureVector.append(w.lower())
      return featureVector
  #end
  
  #fp.close()
  # initialize stopWords
  stopWords = []
  
  inpTweets=fp
  featureList=[]
  #Read the tweets one by one and process it
  tweets = []
  for row in inpTweets:
      sentiment = row[0]
      tweet = row[1]
      processedTweet = processTweet(tweet)
      featureVector = getFeatureVector(processedTweet, stopWords)
      featureList.extend(featureVector)
      tweets.append((featureVector, sentiment));
  #end loop
  
  #start extract_features
  def extract_features(tweet):
      tweet_words = set(tweet)
      features = {}
      for word in featureList:
          features['contains(%s)' % word] = (word in tweet_words)
      #print "Features are: "+features
      return features
  
  #end
  
  #print "Feature List is:"+"\n"+featureList
  
  # Remove featureList duplicates
  featureList = list(set(featureList))
  training_set = nltk.classify.util.apply_features(extract_features, tweets)
  # start replaceTwoOrMore
  def replaceTwoOrMore(s):
      # look for 2 or more repetitions of character and replace with the character itself
      pattern = re.compile(r"(.)\1{1,}", re.DOTALL)
      return pattern.sub(r"\1\1", s)
  
  
  # end
  
  # start getStopWordList
  def getStopWordList(stopWordListFileName):
      # read the stopwords file and build a list
      stopWords = []
      stopWords.append('AT_USER')
      stopWords.append('URL')
  
      fp = open(stopWordListFileName, 'r')
      line = fp.readline()
      while line:
          word = line.strip()
          stopWords.append(word)
          line = fp.readline()
      fp.close()
      return stopWords
  
  
  # end
  
  # start getfeatureVector
  def getFeatureVector(tweet):
      featureVector = []
      # split tweet into words
      words = tweet.split()
      for w in words:
          # replace two or more with two occurrences
          w = replaceTwoOrMore(w)
          # strip punctuation
          w = w.strip('\'"?,.')
          # check if the word stats with an alphabet
          val = re.search(r"^[a-zA-Z][a-zA-Z0-9]*$", w)
          # ignore if it is a stop word
          if (w in stopWords or val is None):
              continue
          else:
              featureVector.append(w.lower())
      return featureVector
  
  
  # Train the classifier
  NBClassifier = nltk.NaiveBayesClassifier.train(training_set)
  
  # Test the classifier
  testTweet = 'Congrats @ashish, The classifier works'
  processedTestTweet = processTweet(testTweet)
  print NBClassifier.classify(extract_features(getFeatureVector(processedTestTweet)))
  
  
  # end
  
  # Read the tweets one by one and process it
  fp = open('/home/ashish/PyCharm_proj/twitter_sentiment/data/sampleData.txt', 'r')
  
  line = fp.readline()
  
  stopWords = getStopWordList('/home/ashish/PyCharm_proj/twitter_sentiment/data/feature_list/stopwords.txt')
  print "\n Feature vectors are:\n "
  while line:
      processedTweet = processTweet(line)
      featureVector = getFeatureVector(processedTweet)
      print featureVector
      line = fp.readline()
  # end loop
  fp.close()
  </code></pre>
  
  <p>How can I solve this problem.
  Thanks</p>