Exemplo n.º 1
0
def TN(analyzer,N):
    rank=oms.newMap('BST',comparefunction=comparerMap)
    rankp=oms.newMap('BST',comparefunction=comparerMap)
    sancocho=om.valueSet(analyzer["indice"])
    for papa in sancocho:
        if oms.contains(rank,papa["company"])==True:
            new=oms.get(rank,papa["company"])
            nueva=int(new.values())+1
            oms.put(rank,str(new.keys()),nueva)
            if papa["company"]=="" and oms.contains(rank,"Independent Owner")==True:
                news=oms.get(rank,"Independent Owner")
                nuevas=int(news.values())+1
                oms.put(rank,str(news.keys()),nuevas)
        else:
            if papa["company"]=="":
                oms.put(rank,"Independent Owner",1)
            oms.put(rank,papa["company"],1)

    for com in list(rank):
        oms.put(rankp,int(com.values()),str(com.keys()))

    rankesito=lt.newList()
    for puesto in range(N):
        p=oms.maxKey(rankp)
        lt.addLast(rankesito,dict(list(rank.keys())[list(rank.values()).index(p)],p))
        oms.deleteMax(rankp)
    return rankesito
Exemplo n.º 2
0
def TM(analyzer,M):
    rank=oms.newMap('BST',comparefunction=comparerMap)
    rankp=oms.newMap('BST',comparefunction=comparerMap)
    sancocho=om.valueSet(analyzer["indice"])
    for papa in sancocho:
        if oms.contains(rank,papa["company"])==True:
            new=oms.get(rank,papa["company"])
            nueva=lt.newList(new.values())
            lt.addLast(nueva,papa["taxi_id"])
            oms.put(rank,str(new.keys()),nueva)
            if papa["company"]=="" and oms.contains(rank,"Independent Owner")==True:
                news=oms.get(rank,"Independent Owner")
                nuevas=lt.newList(news.values())
                lt.addLast(nuevas,papa["taxi_id"])
                oms.put(rank,str(news.keys()),nuevas)
        else:
            if papa["company"]=="":
                oms.put(rank,"Independent Owner",1)
            oms.put(rank,papa["company"],1)

    for com in list(rank):
        oms.put(rankp,lt.size(set(list(com.values()))),str(com.keys()))

    ranki=lt.newList()
    for puesto in range(M):
        p=oms.maxKey(rankp)
        lt.addLast(ranki,dict(om.keySet(rank)[om.valueSet(rank).index(p)],p))
        oms.deleteMax(rankp)
    return ranki
Exemplo n.º 3
0
def maxKey(map):
    """
    Retorna la mayor llave de la tabla de simbolos
    Args:
        map: La tabla de simbolos
    Returns:
        La mayor llave de la tabla
    Raises:
        Exception
    """
    return om.maxKey(map)