def process_sentence(sentence, start_word='<S>', end_word='</S>'):
 try:
  import nltk
 except:
  raise Exception('Hint : NLTK is required.')
 if (start_word is not None):
  process_sentence = [start_word]
 else:
  process_sentence = []
 process_sentence.extend(nltk.tokenize.word_tokenize(sentence.lower()))
 if (end_word is not None):
  process_sentence.append(end_word)
 return process_sentence

def process_sentence ( sentence , start_word = '<S>' , end_word = '</S>' ) : try : import nltk except : raise Exception ( 'Hint : NLTK is required.' ) if ( start_word is not None ) : process_sentence = [ start_word ] else : process_sentence = [ ] process_sentence . extend ( nltk . tokenize . word_tokenize ( sentence . lower ( ) ) ) if ( end_word is not None ) : process_sentence . append ( end_word ) return process_sentence
converts a sentence string into a list of string words .