lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I used (a variation of) the attached script to parse build logs for
error and warning phrases.  Although I had only a small number of
phrases (50-100) I have good hopes that it is still useful in your
situation.  No promises though.  It uses a combination of suffix tries
and Lua pattern matching and is a mere 137 lines long.  The file
contains a very concise description of the functionality.  Roughly,
you use "maketrie" to preprocess an array of phrases (this has to be
done only once and you can save the result with the "dumptrie"
function if you want.)  Then use "hasphrase" to test if a text
contains any of those phrases.  It just returns true/false but it
wouldn't be hard to get some more information (e.g. the phrase that
matched and the index in the text.)

Let me know if this worked/didn't work for you!


Attachment: phrase.lua
Description: Binary data