def standardize(self, dep_graph: DependencyGraph, oia_graph: OIAGraph,
                    context: UD2OIAContext, options: WorkFlowOptions):
        """

        @param dep_graph:
        @type dep_graph:
        @return:
        @rtype:
        """
        def __standardized_hook():
            self.standardized = True
            return self.working_stack()

        oia_graph.set_context_hook(__standardized_hook)

        if options.debug:
            context.debugger.record("standardize", "init", oia_graph)

        for index, standardizer in enumerate(self.standardizers):
            try:
                self.standardized = False
                standardizer.forward(oia_graph)
                if options.debug and self.standardized:
                    context.debugger.record("standardize",
                                            type(standardizer).__name__,
                                            oia_graph)

            except Exception as e:

                logger.opt(exception=True).error(
                    "Error when running Standardize: ",
                    type(standardizer).__name__)
                raise e
    def generate(self, dep_graph: DependencyGraph, context: UD2OIAContext,
                 options: WorkFlowOptions):
        """

        @param dep_graph:
        @type dep_graph:
        @return:
        @rtype:
        """

        oia_graph = OIAGraph()

        node_dict = dict((node.ID, node) for node in dep_graph.origin_nodes()
                         if node.LOC >= 0)
        node_list = sorted(node_dict.values(), key=lambda node: node.LOC)
        oia_graph.set_words([x.FORM for x in node_list])

        logger.debug(oia_graph.words)

        def __oia_updated_hook():
            self.oia_updated = True
            return self.working_stack()

        oia_graph.set_context_hook(__oia_updated_hook)

        for index, generator in enumerate(self.generators):
            try:
                self.oia_updated = False
                generator(dep_graph, oia_graph, context)
                if options.debug and self.oia_updated:
                    context.debugger.record("generate", generator.__name__,
                                            oia_graph)

            except Exception as e:
                if options.debug:
                    context.debugger.record("generate", generator.__name__,
                                            oia_graph, str(e))

                traceback.print_exc(file=sys.stderr)
                logger.error(e)

        return oia_graph