def number_of_tokens(sentences, category=None):
    """
    Count the number of words in sentences
    If category is given, only count words of this category, otherwise count all
    Args:
        sentences (list) : the list of Sentence objects
        category (str, default None) : the category to count
    Return:
        the count of words in sentences of category
    """
    #si catégore = NON on prend tous les mots
    #sinon on prends tous les mots avec la bonne catégorie
#    return sum([word for word in sentence.words 
#               for sentence in sentences 
#               if category is None or word.upos == category])
    somme = 0 
    for sentence in sentences:
        for word in sentence.words:
            if category is None:
                somme =+1
            elif word.upos == category:
                somme += 1
    return somme