title: Counting and averaging words in sentences
body: <p>I must use Python to print the number of words and mean length of words in each sentence of a text file.  I cannot use NLTK or Regex for this assignment.</p>
  
  <blockquote>
    <p>The sentence in the file ends with a period, exclamation point, or question mark. A hyphen, dash, or apostrophe does not end a sentence. Quotation marks do not end a sentence. But also, some periods do not end sentences. For example, Mrs., Mr., Dr., Fr., Jr., St., are all commonly occurring abbreviations.</p>
  </blockquote>
  
  <p>For example, if input text is:</p>
  
  <pre class="lang-none prettyprint-override"><code>"My name? Bob. Your name? Lily! Hi there"
  </code></pre>
  
  <p>...output should be:</p>
  
  <pre class="lang-none prettyprint-override"><code>[(no. of words, mean length of words in sentence1),
  (no. of words, mean length of words in sentence2),
  ...]
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>p= ("Mrs.","Mr.","St.")
  def punct_after_ab(texts):
      new_text = texts
      for abb in p:
          new_text = new_text.replace(abb,abb[:-1])
      return print(new_text)
  
  import numpy
  def word_list(text):
      special_characters = ["'",","]
      clean_text = text
      for string in special_characters:
          clean_text = clean_text.replace(string, "")
      count_list = [len(i) for i in clean_text.split()]
      count = [numpy.mean(count_list)]
      return print((count_list),(count))
  </code></pre>
  
  <p>But when I tested this, it does not split sentences.</p>