예제 #1
0
        private bool TryMergeLogData(Log log, out LogTemplate result)
        {
            result = null;
            if (this.UnmatchedLogPool.ContainsKey(log.Words.Length))
            {
                var pool = this.UnmatchedLogPool[log.Words.Length];
                foreach (var unmatchedLog in pool)
                {
                    if (TemplateCorrection.TryMerge(log.Words, unmatchedLog.Words, this.LcsThreshold, this.LcsTokensOnly, out result))
                    {
                        pool.Remove(unmatchedLog);
                        result.LogIds = new List <int> {
                            log.LogId, unmatchedLog.LogId
                        };

                        return(true);
                    }
                }
            }
            else
            {
                this.UnmatchedLogPool.Add(log.Words.Length, new List <Log>());
            }

            this.UnmatchedLogPool[log.Words.Length].Add(log);
            return(false);
        }
예제 #2
0
        private bool TryAbsorbTemplate(LogTemplate template, out LogTemplate result)
        {
            result = null;
            if (this.TokenIndexer.ContainsKey(template.TokensHash))
            {
                var list = this.TokenIndexer[template.TokensHash];
                foreach (var tryTemplateId in list)
                {
                    if (TemplateCorrection.TryAbsorb(template, this.Templates[tryTemplateId], out result))
                    {
                        result.LogIds = template.LogIds
                                        .Concat(this.Templates[tryTemplateId].LogIds)
                                        .ToList();

                        this.RemoveTemplate(tryTemplateId);
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #3
0
        private bool TryMergeTemplate(LogTemplate template, out LogTemplate result)
        {
            result = null;
            if (this.LengthIndexer.ContainsKey(template.Length))
            {
                var list = this.LengthIndexer[template.Length];
                foreach (var tryTemplateId in list)
                {
                    if (TemplateCorrection.TryMerge(template.Sequence, this.Templates[tryTemplateId].Sequence, this.LcsThreshold, this.LcsTokensOnly, out result))
                    {
                        result.LogIds = template.LogIds
                                        .Concat(this.Templates[tryTemplateId].LogIds)
                                        .ToList();

                        //this.Templates[templateId].EmergedId = result.TemplateId;
                        this.RemoveTemplate(tryTemplateId);

                        return(true);
                    }
                }
            }
            return(false);
        }