<?xml version="1.0" encoding="UTF-8"?>

<!--hidden markov model -->
<!ELEMENT HMM (alphabet*, classAlphabet?, background*, state+, transition*, switchingFunction?)>
<!ATTLIST HMM
        version           CDATA #IMPLIED
        type              CDATA #REQUIRED
        name              CDATA #IMPLIED
        prior             CDATA #IMPLIED
        transitionClasses CDATA #IMPLIED
>

<!-- alphabet/emissionDomain can be more than one (pairHMMs) -->
<!ELEMENT alphabet (symbol+)>
<!ATTLIST alphabet
        id CDATA #REQUIRED
>
<!-- hold a maps class labels to integers -->
<!ELEMENT classAlphabet (symbol+)>

<!-- maps symbols (class labels) to integers -->
<!ELEMENT symbol (#PCDATA)>
<!ATTLIST symbol
        code CDATA #REQUIRED
>

<!-- background distribution holds CSV -->
<!ELEMENT background (#PCDATA)>
<!ATTLIST background
        key   CDATA #REQUIRED
        order CDATA #IMPLIED
>

<!-- states - integer id from 0 to N-1 -->
<!ELEMENT state ((silent | discrete | mixture | pair), backgroundKey?, class?, duration?, position?, tiedTo?)>
<!ATTLIST state
        id      CDATA #REQUIRED
        initial CDATA #REQUIRED
        desc    CDATA #IMPLIED
>
<!-- different emission types, must not differ in one model, except discrete is a higherOrder with order=0 -->
<!ELEMENT silent EMPTY>
<!ELEMENT discrete (#PCDATA)>
<!ATTLIST discrete
        id    CDATA #REQUIRED
        order CDATA #IMPLIED
        fixed CDATA #IMPLIED
>
<!ELEMENT mixture (HMM+ | (normal | normalLeftTail | normalRightTail | uniform | multinormal)+)>
<!ATTLIST mixture
        version      CDATA #IMPLIED
        noComponents CDATA #IMPLIED
>
<!ELEMENT pair (#PCDATA)>
<!-- different density functions for mixture-models -->
<!ELEMENT normal EMPTY>
<!ATTLIST normal
        mean     CDATA #REQUIRED
        variance CDATA #REQUIRED
        prior    CDATA #IMPLIED
        approx   CDATA #IMPLIED
        fixed    CDATA #IMPLIED
>
<!ELEMENT multinormal (mean, variance)>
<!ATTLIST multinormal
        dimension CDATA #REQUIRED
        prior     CDATA #IMPLIED
        fixed     CDATA #IMPLIED
>
<!ELEMENT mean (#PCDATA)>
<!ELEMENT variance (#PCDATA)>

<!ELEMENT normalLeftTail EMPTY>
<!ATTLIST normalLeftTail
        mean     CDATA #REQUIRED
        variance CDATA #REQUIRED
        max      CDATA #REQUIRED
        prior    CDATA #IMPLIED
        fixed    CDATA #IMPLIED
>
<!ELEMENT normalRightTail EMPTY>
<!ATTLIST normalRightTail
        mean     CDATA #REQUIRED
        variance CDATA #REQUIRED
        min      CDATA #REQUIRED
        prior    CDATA #IMPLIED
        fixed    CDATA #IMPLIED
>
<!ELEMENT uniform EMPTY>
<!ATTLIST uniform
        min   CDATA #REQUIRED
        max   CDATA #REQUIRED
        prior CDATA #IMPLIED
        fixed CDATA #IMPLIED
>

<!-- Name of a background distribution,
     order of the background distribution and the states emission must match -->
<!ELEMENT backgroundKey (#PCDATA)>

<!-- class label id -->
<!ELEMENT class (#PCDATA)>

<!-- duration  -->
<!ELEMENT duration (#PCDATA)>

<!-- position for the graphical editor -->
<!ELEMENT position EMPTY>
<!ATTLIST position
        x CDATA #REQUIRED
        y CDATA #REQUIRED
>

<!-- emissions are tied to state -->
<!ELEMENT tiedTo (#PCDATA)>

<!-- transitions - probability is a float in [0.0,1.0] for transition classes CSV -->
<!ELEMENT transition (probability+)>
<!ATTLIST transition
        source CDATA #REQUIRED
        target CDATA #REQUIRED
>
<!ELEMENT probability (#PCDATA)>

<!-- switchingFunction contains an attribute type and 
     holds optionally data for the switching function -->
<!ELEMENT switchingFunction (#PCDATA)>
<!ATTLIST switchingFunction
        type CDATA #REQUIRED
>
