code: def split_sentences_spacy(text, language_model='en'):
      r
      doc = nlp(text)
      sentences = []
      if not hasattr(doc, 'sents'):
          logger.warning("Using NLTK sentence tokenizer because SpaCy language model hasn't been loaded")
          return split_sentences_nltk(text)
      for w, span in enumerate(doc.sents):
          sent = ''.join(doc[i].string for i in range(span.start, span.end)).strip()
          if len(sent):
              sentences.append(sent)
      return sentences
docs: r""" You must download a spacy language model with python -m download 'en'
  
      The default English language model for spacy tends to be a lot more agressive than NLTK's punkt:
  
      >>> split_sentences_nltk("Hi Ms. Lovelace.\nI'm a wanna-\nbe human @ I.B.M. ;) --Watson 2.0")
      ['Hi Ms. Lovelace.', "I'm a wanna-\nbe human @ I.B.M.", ';) --Watson 2.0']
      >>> split_sentences_spacy("Hi Ms. Lovelace.\nI'm a wanna-\nbe human @ I.B.M. ;) --Watson 2.0")
      ['Hi Ms. Lovelace.', "I'm a wanna-", 'be human @', 'I.B.M. ;) --Watson 2.0']
  
      >>> split_sentences_spacy("Hi Ms. Lovelace. I'm at I.B.M. --Watson 2.0")
      ['Hi Ms. Lovelace.', "I'm at I.B.M. --Watson 2.0"]
      >>> split_sentences_nltk("Hi Ms. Lovelace. I'm at I.B.M. --Watson 2.0")
      ['Hi Ms. Lovelace.', "I'm at I.B.M.", '--Watson 2.0']