title: Average sentence length for every text in corpus (python3 & nltk)
body: <p>I'm analyzing the inaugural address corpus in the NLTK package as part of an introduction to python programming course. I'd like to find out the average sentence length of each text within the corpus (so that I can later compare them), but I seem to be stuck here. </p>
  
  <p>I've created this function:</p>
  
  <pre><code>def averageSentence(text):
      sents = inaugural.sents(fileids=['fileid_here.txt']  
      avg = sum(len(word) for word in sents) / len(sents)  
      print(avg)
  </code></pre>
  
  <p>which (if I'm correct) should give me the average sentence length for an individual text. Now, I know I need a <em>for loop</em>. Shouldn't I be able to make a relatively easy and straightforward for loop with this function I just defined? This is very frustrating. </p>
  
  <p>EDIT: this is how far I have gotten:</p>
  
  <pre><code>for fileid in inaugural.fileids():
      avg_sents = averageSentence(fileid)
      print = sum(avg_sents) / avg_sents
  </code></pre>