(ngrams, fipscode, geonameid, date, hour)
Validate ngrams against wikipedia phrases and emit to stdout
Validate ngrams against wikipedia phrases and emit to stdout
Validate ngrams against wikipedia phrases and emit to stdout
def emit_phrases(ngrams, fipscode, geonameid, date, hour):
  '''Validate ngrams against wikipedia phrases and emit to stdout'''
  for ngram in ngrams:
    try:
      #exclude numbers
      int(ngram)
    except:  
      #exclude special chars
      if len(ngram.strip()) > 1:
        print '\t'.join([ngram, fipscode, geonameid, date, hour])
def emit_phrases ( ngrams , fipscode , geonameid , date , hour ) : for ngram in ngrams : try : #exclude numbers int ( ngram ) except : #exclude special chars if len ( ngram . strip ( ) ) > 1 : print '\t' . join ( [ ngram , fipscode , geonameid , date , hour ] )