Skip to content

Commit

Permalink
Update Spell.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Zhu committed Mar 17, 2019
1 parent ccd355d commit 5c280b4
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions logparser/Spell/Spell.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,15 @@ def LCS(self, seq1, seq2):


def SimpleLoopMatch(self, logClustL, seq):
retLogClust = None

for logClust in logClustL:
if float(len(logClust.logTemplate)) < 0.5 * len(seq):
continue

#If the template is a subsequence of seq
it = iter(seq)
if all(token in seq or token == '*' for token in logClust.logTemplate):
# Check the template is a subsequence of seq (we use set checking as a proxy here for speedup since
# incorrect-ordering bad cases rarely occur in logs)
token_set = set(seq)
if all(token in token_set or token == '*' for token in logClust.logTemplate):
return logClust

return retLogClust
return None


def PrefixTreeMatch(self, parentn, seq, idx):
Expand Down

0 comments on commit 5c280b4

Please sign in to comment.