salutations,

thank you for the responses.

here is an example of pattern:

suppose we have an user input, "shivâshvah", which means "Shiva's horse" in Sanskrit language. the program divides the word by commas (indicating possible morphemes) in several possibilities: "shivâshvah,"; "shivâshv,ah", "shivâ,shvah"... and, for each division possibility, it checks for the existence, in the array, of each morpheme of the divided word, and it does so by the use of patterns; for example, the division "shivâ,shvah", will be analyzed as "shiv(â|a),(a*)shvah", and then "shiv(â|a)" and "(a*)shvah" will be both checked in the array. is it enough to get an idea of the number of patterns? because, as it deals with a different language, it's difficult to explain.

How many patterns? basically, there will be as much patterns as there are morphemes for each division possibility of the user's input.

are they the same every time? no, there are as many different patterns as there are morpheme possibilities to be analyzed.

How often do you do this? pattern matching is done for every morpheme of every division possibility (shivâshva,h; shiv,âshv,ah; ...) of the user's input (which would be shivâshvah in the case).

How slow is "too slow"?

well, when we run a very basic test with an array of 274947 items and 16 (test) patterns (acting like different user inputs), it took about 7 seconds. but imagine it for, like, 4000 patterns... a word like shivâshvah (treating sh as a single character) would have 255 morpheme division possibilities from "shivâshvah," to "sh,i,v,â,sh,v,a,h", and, for "sh,i,v,â,sh,v,a,h" -> "sh,i,v,(â|a),(â*|a*)sh,v,a,h", 8 words would have to be checked in the array, ONLY for this division possibility.

salutations,

In reply to Re: parsing a very large array with regexps by pc2
in thread parsing a very large array with regexps by pc2

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.