I'm faced with the following problem:
I have an array which is produced by the parsing of a yaml file which contains patterns in the following structure.
"Programming books"
Title:
a list of titles
Author:
"Art Books"
Title:
foo
bar
Author:
Mrs. Foo
Mr. Bar
Year:
the program is supposed to be given random input and find if there is a book with that particular Title,Author and Year.
So far I'm using the following
foreach book_type,values from config{
tag_match = 0
foreach tag from values{
tag_no = values.length()
foreach value from tag{
if value in input
tag_match++
}
}
if tag_match == values.length()
/* tag the book matched continue matching*/
}
The program is not supposed to receive many matching lines bu it is supposed to receive a huge amount of data. So far it has to do book_type.length() * tag.length() * value.length() iterations for each line of input, is there a better way to do this?