(self, n: int)
return make_pipeline(op) if op else NoOp
Sample the grammar `g` starting from `g.start`, that is, choose one element at random for each possible choices.

        Parameters
        ----------
        n : int
            number of derivations

        Returns
        -------
        PlannedOperator
Sample the grammar `g` starting from `g.start`, that is, choose one element at random for each possible choices.
Sample the grammar g starting from g . start that is choose one element at random for each possible choices .
def sample(self, n: int) -> PlannedOperator:
        """
        Sample the grammar `g` starting from `g.start`, that is, choose one element at random for each possible choices.

        Parameters
        ----------
        n : int
            number of derivations

        Returns
        -------
        PlannedOperator
        """
        assert hasattr(self, "start"), "Rule start must be defined"
        op = self._sample(self.start, n)
        return make_pipeline(op) if op else NoOp
def sample ( self , n : int ) -> PlannedOperator : assert hasattr ( self , "start" ) , "Rule start must be defined" op = self . _sample ( self . start , n ) return make_pipeline ( op ) if op else NoOp