'''
Base NLP utilities
'''


def get_words(sentence):
    ''' Return all the words found in a sentence.
    Ignore whitespace and all punctuation
    >>> get_words('a most interesting piece')
    >>> ['a', 'most', 'interesting', 'piece']
    >>> get_words('a, most$ **interesting   piece')
    >>> ['a', 'most', 'interesting', 'piece']
    '''
    clean_sentence = ''.join([char for char in sentence if ord(char) in
                             xrange(97, 123) or ord(char) in xrange(75, 91)
                             or ord(char) == 32])
    segments = clean_sentence.split(' ')
    words = [word for word in segments if not word == '']
    return words

'''
Base NLP utilities
'''


def get_words(sentence):
    ''' Return all the words found in a sentence.
    Ignore whitespace and all punctuation
    >>> get_words('a most interesting piece')
    >>> ['a', 'most', 'interesting', 'piece']
    >>> get_words('a, most$ **interesting   piece')
    >>> ['a', 'most', 'interesting', 'piece']
    '''
    clean_sentence = ''.join([char for char in sentence if char.isalpha()
                             or char.isspace()])
    segments = clean_sentence.split(' ')
    words = [word for word in segments if not word == '']
    return words

Replace ASCII checking chars and space with library methods
Replace ASCII checking chars and space with library methods

  '''
  Base NLP utilities
  '''
  
  
  def get_words(sentence):
      ''' Return all the words found in a sentence.
      Ignore whitespace and all punctuation
      >>> get_words('a most interesting piece')
      >>> ['a', 'most', 'interesting', 'piece']
      >>> get_words('a, most$ **interesting   piece')
      >>> ['a', 'most', 'interesting', 'piece']
      '''
-     clean_sentence = ''.join([char for char in sentence if ord(char) in
+     clean_sentence = ''.join([char for char in sentence if char.isalpha()
-                              xrange(97, 123) or ord(char) in xrange(75, 91)
-                              or ord(char) == 32])
+                              or char.isspace()])
      segments = clean_sentence.split(' ')
      words = [word for word in segments if not word == '']
      return words
  
Replace ASCII checking chars and space with library methods
## Code Before:
'''
Base NLP utilities
'''


def get_words(sentence):
    ''' Return all the words found in a sentence.
    Ignore whitespace and all punctuation
    >>> get_words('a most interesting piece')
    >>> ['a', 'most', 'interesting', 'piece']
    >>> get_words('a, most$ **interesting   piece')
    >>> ['a', 'most', 'interesting', 'piece']
    '''
    clean_sentence = ''.join([char for char in sentence if ord(char) in
                             xrange(97, 123) or ord(char) in xrange(75, 91)
                             or ord(char) == 32])
    segments = clean_sentence.split(' ')
    words = [word for word in segments if not word == '']
    return words

## Instruction:
Replace ASCII checking chars and space with library methods
## Code After:
'''
Base NLP utilities
'''


def get_words(sentence):
    ''' Return all the words found in a sentence.
    Ignore whitespace and all punctuation
    >>> get_words('a most interesting piece')
    >>> ['a', 'most', 'interesting', 'piece']
    >>> get_words('a, most$ **interesting   piece')
    >>> ['a', 'most', 'interesting', 'piece']
    '''
    clean_sentence = ''.join([char for char in sentence if char.isalpha()
                             or char.isspace()])
    segments = clean_sentence.split(' ')
    words = [word for word in segments if not word == '']
    return words
