def __init__(self, dictionary=None, mode='ed'):
    assert (mode in ['trie', 'ed']), 'Mode is not supported'
    self.mode = mode
    self.dictionary = dictionary
    self.use_trie = False
    self.use_ed = False
    if (self.mode == 'trie'):
        self.use_trie = True
    if (self.mode == 'ed'):
        self.use_ed = True
    if self.use_ed:
        self.ed = correction.get_heuristic_correction('diff')
    if self.use_trie:
        self.trie = correction.get_heuristic_correction('trie')
    if (self.use_ed or self.use_trie):
        if (self.dictionary is None):
            self.dictionary = {}
            df = pd.read_csv('./modules/retrieval/heuristic/custom-dictionary.csv')
            for (id, row) in df.iterrows():
                self.dictionary[row.text.lower()] = row.lbl
def __init__(self, dictionary=None, mode='ed'):
    assert (mode in ['trie', 'ed']), 'Mode is not supported'
    self.mode = mode
    self.dictionary = dictionary
    self.use_trie = False
    self.use_ed = False
    if (self.mode == 'trie'):
        self.use_trie = True
    if (self.mode == 'ed'):
        self.use_ed = True
    if self.use_ed:
        self.ed = correction.get_heuristic_correction('diff')
    if self.use_trie:
        self.trie = correction.get_heuristic_correction('trie')
    if (self.use_ed or self.use_trie):
        if (self.dictionary is None):
            self.dictionary = {}
            df = pd.read_csv('./modules/retrieval/heuristic/custom-dictionary.csv')
            for (id, row) in df.iterrows():
                self.dictionary[row.text.lower()] = row.lbl