title: Spanish word tokeniser
body: <p>I would like to tokenise Spanish sentences into words. Is the following the correct approach or is there a better way of doing this?</p>
  
  <pre><code>import nltk
  from nltk.tokenize import word_tokenize
  
  def spanish_word_tokenize(s):
      for w in word_tokenize(s):    
          if w[0] in ("¿","¡"):   
              yield w[0]
              yield w[1:]
          else:
              yield w          
  
  sentences = "¿Quién eres tú? ¡Hola! ¿Dónde estoy?"
  
  spanish_sentence_tokenizer = nltk.data.load('tokenizers/punkt/spanish.pickle')
  
  sentences = spanish_sentence_tokenizer.tokenize(sentences)
  for s in sentences:
      print([s for s in spanish_word_tokenize(s)])
  </code></pre>