def __init__(self, model_id_, model_handler=model_handler(), n_of_gram_=1):
     """
     note: message must be a list of words.
     input parameters: list of words and n which any node will be at parameter n_of_gram_ms
     for ex: if n_of_gram_ms will be 3 than
     mc of a,b,c,d will be
     (a,b,c),1/2 --- 1 ---> (b,c,d),1/2
     with relations count is len of (list of words) -- n and with plus - is count of words/
     count of unique words/relations see: len(obj.words/relations)
     
     you must create this model at data base engine.
     """
     self.n_of_gram_ = n_of_gram_
     self.model_id_ = model_id_
     self.handler = model_handler
     self._id = model_id_
     self.graph = nx.DiGraph()
     self.words_count = 0
#        if w_right_d == 0:
#            w_right_d = 1
#        w_el += float(w_right_i + w_right_s) / w_right_d
#
#        el *= w_el
        tolerance += el

    defence_l, n_tol_l = calc_defence(diff_left_ids, int_ids, model_left_id, left_w, model_handler)
    defence_r, n_tol_r = calc_defence(diff_right_ids, int_ids, model_right_id, right_w, model_handler)
    defence = defence_l + defence_r
    tolerance += n_tol_l + n_tol_r

    return tolerance - defence

if __name__ == '__main__':
    handler = model_handler(truncate=True)

    mc1 = markov_chain('left_test', handler, n_of_gram_=1)
    mc1.add_message([u'ф', 'd3', 'd2'])
    mc1.add_message(['i1', 'd3', 'i2'])
    mc1.add_message(['i1', 'i4'])
    mc1.add_message(['i1', 'i2', 'i3'])

    mc1.print_me()

    mc2 = markov_chain('right_test', handler, n_of_gram_=1)

    mc2.add_message(['d2_', 'd1_', 'd3_'])
    mc2.add_message(['i2', 'i1', 'i3', 'i2'])
    mc2.add_message(['i1', 'i3', 'i4'])
    mc2.add_message(['d1_', 'i3', 'i4', 'd1_'])