Hi, all, Thanks very much for all your replies.Learned a lot from you guys.
I have two files,each of them is sentences.For example file1 has sentences:
A C D E G F D
C B F D E A
A A C F D B A
file2 has sentences:
A C D
F D B
F D D
the result would be for each of the sentence in file 1 matching each of the sentence in file 2, return the longest common substring and their index on a word level between the two sentences.

RESULT:
for sentence 1 in file 1
LCS :A C D0,3 F D5,6 F D5,6
Original Sentence:A C D E G F D

sentence 2 in file 1
LCS :A5,5 C0,0 D3,3 F D3,4 F D 3,4
Original Sentence:C B F D E A

sentence 3 in file 1
LCS :A C1,2 F D B3,5 F D3,4
Original Sentence:A A C F D B A

So is there any way to make this process more efficiency?

In reply to Re^2: LCS efficiency problem by zhe
in thread LCS efficiency problem by zhe

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.