def substitute(self, r):
        self.cleanup()
        self.n.cleanup()
        self.p.insert_after(NonTerminal(r))
        if not self.p.check():
            self.p.n.check()
Replace a digram with a non-terminal.
dataset/ETHPy150Open ResilientScience/wot/wot/sequitur.py/Symbol.substitute