24 lines
742 B
Python
24 lines
742 B
Python
from typing import List, Union
|
|
|
|
from Processor.Models.LogVariable import LogVariable
|
|
|
|
|
|
class LogTemplate:
|
|
def __init__(self, uid: int, tokens: List[Union[str, LogVariable]], representative_log: str):
|
|
self.uid = uid
|
|
self.tokens = tokens
|
|
self.representative_log = representative_log
|
|
self.embedding = None
|
|
self.hits = 1
|
|
self.local_var_counter = 1
|
|
|
|
def get_tokens_as_str_list(self) -> List[str]:
|
|
return [str(t) if isinstance(t, LogVariable) else t for t in self.tokens]
|
|
|
|
def render(self) -> str:
|
|
return "".join(str(t) for t in self.tokens)
|
|
|
|
def get_next_var_id(self) -> int:
|
|
vid = self.local_var_counter
|
|
self.local_var_counter += 1
|
|
return vid |