The first two things you must do is read the essay and divide it into words. The best way to read it depends on how you plan to divide it. The best way to divide it depends on the format of the essay and your definition of 'word'. You probably think that this is obvious and if there is an occasional problem, you will deal with it later. That is a big mistake. For simplicity, let us assume that the essay consists only of English words (only ASCII letters, no numbers, no hyphenated or foreign words) with standard English punctuation(,.'"?!). I will also assume that the essay is less than 10,000 characters long and that it is divided into lines less than 80 characters long. Lines are separated by newlines. Paragraphs are separated by blank lines. Sentences are separated by two spaces (or a newline). Words are separated by a single space. A program which handles this very well may be extremely difficult to modify, You should let us know which of these assumptions are not true and which are likely to change in the future.

You specify four outputs. Do you really want them all written to the same file? If so, how whould they be identified (or at least separated)?

Bill

In reply to Re: Help sorting contents of an essay by BillKSmith
in thread Help sorting contents of an essay by harmattan_

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.