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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |