title: Count number of sentences in a text file
body: <p>Sentences I guess being string that end in ! ? .</p>
  
  <p>Excepting thing like Dr. Mr.
  It is true that you cannot really know a sentence in java because of grammar.</p>
  
  <p>But I guess what I mean is a period or exclamation mark or question mark and then what follows being a capital letter. </p>
  
  <p>How would one do this.</p>
  
  <p>This be what I have
  But its not working.....</p>
  
  <pre><code>      BufferedReader Compton = new BufferedReader(new FileReader(fileName));
          int sentenceCount=0;
  
          String violet;
  
          String limit="?!.";
          while(Compton.ready())
          {
              violet=Compton.readLine();
  
              for(int i=0; i&lt;violet.length()-1;i++)
              {
                  if(limit.indexOf(violet.charAt(i)) != -1 &amp;&amp; i&gt;0 &amp;&amp; limit.indexOf(violet.charAt(i-1)) != -1)
                  {
                      sentenceCount++;
                  }
              }
          }
              System.out.println("the amount of sentence is " + sentenceCount);
  </code></pre>
  
  <p>EDIT
  New way that works better</p>
  
  <pre><code>          String violet;
          while(Compton.ready())
          {
              violet=Compton.readLine();
              sentenceCount=violet.split("[!?.:]+").length;
              System.out.println("the number of words in line is " + 
  
                sentenceCount);
           }
  </code></pre>