def _check_self_nonterminals(self, optimized):
        """
        For each Rule A -> BC where B and C are known terminals (B -> c1 and C -> c2),
        this function searches replaces A to the corresponding terminals A -> c1c2
        """
        # print 'BFS Dictionary Update - Self Non Terminals'
        find = 0
        for nt in self.grammar.grammar_nonterminals_map:
            for i in self.grammar.grammar_nonterminals_map[nt]:
                if (self.grammar.grammar_rules[i][0] not in self.resolved\
                    or self.grammar.grammar_rules[i][0] == 'S') \
                    and isinstance(self.grammar.grammar_rules[i][1], (set, tuple)):
                    # All rules are in CNF form, so first check the A -> BC rules
                    part_a = None
                    if optimized and self._check_self_to_empty(
                            self.grammar.grammar_rules[i][1][0]):
                        part_a = ''
                    elif self.grammar.grammar_rules[i][1][0] in self.resolved:
                        part_a = self.resolved[self.grammar.grammar_rules[i][1][0]]
                    part_b = None
                    if optimized and self._check_self_to_empty(
                            self.grammar.grammar_rules[i][1][1]):
                        part_b = ''
                    elif self.grammar.grammar_rules[i][1][1] in self.resolved:
                        part_b = self.resolved[self.grammar.grammar_rules[i][1][1]]
                    if part_a is not None and part_b is not None:
                        self.resolved[self.grammar.grammar_rules[i][0]] = part_a + part_b
                        # print 'Non Terminals Resolving
                        # '+self.g.Rules[i][0]+": "+
                        # self.Resolved[self.g.Rules[i][0]]
                        if self._checkfinal(self.grammar.grammar_rules[i][0]):
                            return self.resolved[self.grammar.grammar_rules[i][0]]
                        if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                            self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                        find = 1

        if find == 1:
            return 1
        return 0