function toAlpha(epObj){
    var tranSet=epObj.tranSet,etatsFin=epObj.etatsFin;
    var epMap=new Map(),key,val,elTab,x;
    for (var element of tranSet){
        elTab=element.split(",");
        key=[elTab[0],elTab[1]].toString();
        val=(elTab[2]).toString();
        if(epMap.has(key))
        {
            x=epMap.get(key);
            x.push(val);
            epMap[key]=x;
        }
        else{
            x=[val];
            epMap.set(key,x);
        }
    }
    var length,start,finish,trans,keyM,y,concat;
    var st=0;
    for(key of epMap.keys()){
        x=key.split(",");
        word=x[1];
        i=0;
        length=word.length;
        if (length>1){
            start=x[0];
            finish=epMap.get(key);
            epMap.delete(key);
            while(i<length){
                keyM=[start,word[i]].toString();
                if (i!=length-1)
                {
                    trans=[];
                    trans.push(("T"+(st.toString())).toString());
                }
                else
                {
                    trans=finish;
                }
                start=trans;
                x=[];
                for(val of trans)
                {
                    x.push(val);
                }
                if(epMap.has(keyM)){
                    y=epMap.get(keyM);
                    x=x.concat(y);
                }
                epMap.set(keyM,x)
                st++;
                i++;
            }
        }
    }
    var alphaMap=new Map();
    var keyAlpha;
    var valAlpha;
    for (key of epMap.keys()){
        val=epMap.get(key);
        elTab=key.split(",");
        keyAlpha=elTab[0];
        if (alphaMap.has(keyAlpha)){
            valAlpha=alphaMap.get(keyAlpha);
            valAlpha.set(key,val);
            alphaMap[keyAlpha]=valAlpha;
        }
        else{
            var valAlpha=new Map();
            valAlpha.set(key,val);
            alphaMap.set(keyAlpha,valAlpha);

        }
    }
    /*there's a little problem*/
    console.log("alphaMap");
    console.log({alphaMap,etatsFin});
    etatsFin.sort();
    return {alphaMap,etatsFin};
}
/*passage par mot ==> passage par alphabet*/
passage par mot ==> passage par alphabet
passage par mot == > passage par alphabet
function toAlpha(epObj){
    var tranSet=epObj.tranSet,etatsFin=epObj.etatsFin;
    var epMap=new Map(),key,val,elTab,x;
    for (var element of tranSet){
        elTab=element.split(",");
        key=[elTab[0],elTab[1]].toString();
        val=(elTab[2]).toString();
        if(epMap.has(key))
        {
            x=epMap.get(key);
            x.push(val);
            epMap[key]=x;
        }
        else{
            x=[val];
            epMap.set(key,x);
        }
    }
    var length,start,finish,trans,keyM,y,concat;
    var st=0;
    for(key of epMap.keys()){
        x=key.split(",");
        word=x[1];
        i=0;
        length=word.length;
        if (length>1){
            start=x[0];
            finish=epMap.get(key);
            epMap.delete(key);
            while(i<length){
                keyM=[start,word[i]].toString();
                if (i!=length-1)
                {
                    trans=[];
                    trans.push(("T"+(st.toString())).toString());
                }
                else
                {
                    trans=finish;
                }
                start=trans;
                x=[];
                for(val of trans)
                {
                    x.push(val);
                }
                if(epMap.has(keyM)){
                    y=epMap.get(keyM);
                    x=x.concat(y);
                }
                epMap.set(keyM,x)
                st++;
                i++;
            }
        }
    }
    var alphaMap=new Map();
    var keyAlpha;
    var valAlpha;
    for (key of epMap.keys()){
        val=epMap.get(key);
        elTab=key.split(",");
        keyAlpha=elTab[0];
        if (alphaMap.has(keyAlpha)){
            valAlpha=alphaMap.get(keyAlpha);
            valAlpha.set(key,val);
            alphaMap[keyAlpha]=valAlpha;
        }
        else{
            var valAlpha=new Map();
            valAlpha.set(key,val);
            alphaMap.set(keyAlpha,valAlpha);
        }
    }
    console.log("alphaMap");
    console.log({alphaMap,etatsFin});
    etatsFin.sort();
    return {alphaMap,etatsFin};
}
function toAlpha ( epObj ) { var tranSet = epObj . tranSet , etatsFin = epObj . etatsFin ; var epMap = new Map ( ) , key , val , elTab , x ; for ( var element of tranSet ) { elTab = element . split ( "," ) ; key = [ elTab [ 0 ] , elTab [ 1 ] ] . toString ( ) ; val = ( elTab [ 2 ] ) . toString ( ) ; if ( epMap . has ( key ) ) { x = epMap . get ( key ) ; x . push ( val ) ; epMap [ key ] = x ; } else { x = [ val ] ; epMap . set ( key , x ) ; } } var length , start , finish , trans , keyM , y , concat ; var st = 0 ; for ( key of epMap . keys ( ) ) { x = key . split ( "," ) ; word = x [ 1 ] ; i = 0 ; length = word . length ; if ( length > 1 ) { start = x [ 0 ] ; finish = epMap . get ( key ) ; epMap . delete ( key ) ; while ( i < length ) { keyM = [ start , word [ i ] ] . toString ( ) ; if ( i != length - 1 ) { trans = [ ] ; trans . push ( ( "T" + ( st . toString ( ) ) ) . toString ( ) ) ; } else { trans = finish ; } start = trans ; x = [ ] ; for ( val of trans ) { x . push ( val ) ; } if ( epMap . has ( keyM ) ) { y = epMap . get ( keyM ) ; x = x . concat ( y ) ; } epMap . set ( keyM , x ) st ++ ; i ++ ; } } } var alphaMap = new Map ( ) ; var keyAlpha ; var valAlpha ; for ( key of epMap . keys ( ) ) { val = epMap . get ( key ) ; elTab = key . split ( "," ) ; keyAlpha = elTab [ 0 ] ; if ( alphaMap . has ( keyAlpha ) ) { valAlpha = alphaMap . get ( keyAlpha ) ; valAlpha . set ( key , val ) ; alphaMap [ keyAlpha ] = valAlpha ; } else { var valAlpha = new Map ( ) ; valAlpha . set ( key , val ) ; alphaMap . set ( keyAlpha , valAlpha ) ; } } console . log ( "alphaMap" ) ; console . log ( { alphaMap , etatsFin } ) ; etatsFin . sort ( ) ; return { alphaMap , etatsFin } ; }
passage par mot ==> passage par alphabet
passage par mot == > passage par alphabet
/*there's a little problem*/