def concatenateToken(tokens):
    """
        Concatenate the n-grams into a single string taking
        into account the number of occurrences.
        It is needed because the models works on String only.

        :param tokens: Map of n-grams occurrences
        :type tokens: {Int:{String:Int}}

        :return: Concateneted tokens
        :rtype: String
    """
    res = []
    for _, ngrams in tokens.items():
        for token, f in ngrams.items():
            res += [token] * f
    return res