Trying to rethink this... First, these aren't sentences. They're lists of headlines -- so phrases, each ending with a hard return.

Second, the first script I posited above works just fine in listing the various word pairs and their frequency. So that's not a problem. The PROBLEM I'm having is massive redundancy. Below is a short example of the word pairs found, and their frequency - output from the script above.

OPEN SOURCE 9
WINDOWS XP 8
NERO BURNING 7
BURNING ROM 7
FLAW FOUND 6

Pairs 3 and 4 refer to the same headline. It's something like "Nero Burning ROM." I'd like the script to produce only one pair for each headline. So that once "Nero Burning" is output, "Burning Rom" is recognized as redundant and deleted.

Now there may be an easier way to do this than what I asked for above. As I said, my thinking maybe wasn't straight enough. Possibly a second script, which takes the output file, wordburst.txt, and removes all pairs where there is in the second pair a word which appeared in a previous pair. I've tried to formulate a regex to do this, but no luck.....


In reply to Re: Word Pairs and Lines by bob
in thread Word Pairs and Lines by bob

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.