Class FactorOracle

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, Initializable, TypedActor, ExplicitChangeContext, RefinementActor, Changeable, Debuggable, DebugListener, Derivable, DropTargetHandler, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class FactorOracle
    extends ModalController
    Build a factor oracle (FO) data structure that represents a finite acyclic automaton that contains at least all the suffixes of a given input sequence. The actor accepts a name for the Factor oracle, an Object array, representing the input trainingSequence on which the suffix tree will be built, and a repetitionFactor that is a double in range [0.0,1.0], which is a measure of the probability of the training sequence to be repeated at each transition. The output Factor Oracle will be a probabilistic automaton that can generate at least all the suffixes of the training string. If the validatePitch Parameter is set to true, the factor oracle interprets the input string as a sequence of notes and adds a check to the transitions to validate the note against a specification.

    As an example, if a transition that would generate a "C4" upon firing, the guard expression would look like: validatePitch("C4") && probability(p) , where p is a double in range [0.0,1.0]. This transition would be taken (i) if the probability() transition evaluates to true AND (ii) if validatePitch() returns true.

    References

    [1] C. Allauzen, M. Crochemore, and M. Raffinot. "Factor oracle: A new structure for pattern matching." SOFSEM'99: Theory and Practice of Informatics . Springer Berlin Heidelberg, 1999.

    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Ilge Akkaya
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (ilgea)
    • Field Detail

      • repetitionFactor

        public Parameter repetitionFactor
        The repetition probability P(moving along the original sequence rather than taking a jump along a suffix link).
      • validatePitch

        public Parameter validatePitch
        Boolean that when set to true, enables the transitions to have a condition that validates each pitch against a specification.
      • currentChord

        public TypedIOPort currentChord
        Current chord in improvisation.
    • Constructor Detail

      • FactorOracle

        public FactorOracle​(CompositeEntity container,
                            java.lang.String name,
                            java.lang.Object[] trainingSequence,
                            double repetitionFactor)
                     throws NameDuplicationException,
                            IllegalActionException
        Construct an actor with the given container and name.
        Parameters:
        container - The container.
        name - The name of this actor
        trainingSequence - The input string that the oracle is built from
        repetitionFactor - a double indicating the factor repetition probability
        Throws:
        IllegalActionException - If the actor cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.
      • FactorOracle

        public FactorOracle​(CompositeEntity container,
                            java.lang.String name,
                            java.lang.Object[] trainingSequence,
                            double repetitionFactor,
                            boolean symbolicOutput,
                            boolean validateSymbols)
                     throws IllegalActionException,
                            NameDuplicationException
        Constructs a FactorOracle object.
        Parameters:
        container - The Container
        name - The name
        trainingSequence - An object array containing the training sequence
        repetitionFactor - a double indicating the factor repetition probability
        symbolicOutput - a boolean that determines whether symbolic outputs should be produced
        validateSymbols - a boolean -- true if symbol validation should be included in guard expressions
        Throws:
        IllegalActionException - repetition factor range checking
        NameDuplicationException
    • Method Detail

      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Description copied from class: FSMActor
        Clone the actor into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new actor.
        Overrides:
        clone in class FSMActor
        Parameters:
        workspace - The workspace for the new actor.
        Returns:
        A new FSMActor.
        Throws:
        java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)
      • _getTransitionsFrom

        protected java.util.List<java.lang.Integer> _getTransitionsFrom​(java.lang.Integer node)
        Get a list of transitions originating from node.
        Parameters:
        node - Node index
        Returns:
        a List of states which can be reached from current node