• Pour sortir tous les textes d’un site #SPIP dans un grand fichier #TSV (un article par ligne) :

    echo "SELECT a.id_article,a.titre, a.chapo,a.texte,a.lang, GROUP_CONCAT(DISTINCT u.nom SEPARATOR ', ') AS auteurs, GROUP_CONCAT(DISTINCT m.titre SEPARATOR ', ') AS mots, SUBSTRING(a.date,1,7) AS date FROM spip_articles a LEFT JOIN spip_auteurs_articles au ON a.id_article=au.id_article LEFT JOIN spip_auteurs u ON au.id_auteur=u.id_auteur LEFT JOIN spip_mots_articles am ON a.id_article=am.id_article LEFT JOIN spip_mots m ON am.id_mot=m.id_mot WHERE a.statut IN ('publie') GROUP BY a.id_article;" | mysql $BASE -B > $BASE.tsv

    (ici avec un test sur le statut ’publié’) ; ensuite, on peut regarder le nombre d’articles écrits par Untel (ou parlant de « truc »), avec le nombre de mots et de signes correspondants :

    zgrep -E 'Untel' $BASE.tsv.gz | wc
    1294 1335040 8908699

    ici 1294 articles, 1,3 millions de mots, 8,9 millions de caractères

    Et si on veut, on peut retraiter ça avec awk, voire en SQL avec #q :
    http://seenthis.net/messages/219474

    Après, on va nettoyer tout ça et faire du #text-mining, avec #gensim