Skip to content

Commit

Permalink
feat(contents): new tribunes
Browse files Browse the repository at this point in the history
  • Loading branch information
nfroidure committed Jul 4, 2023
1 parent bc54ad0 commit 8717c97
Show file tree
Hide file tree
Showing 171 changed files with 1,521 additions and 450 deletions.
9 changes: 4 additions & 5 deletions bin/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ run();
async function run() {
const nl = await nodeLefff.load();


const files = await readDir(pathJoin("sources", "tribunes"));
const writtersAggregations = {};
const groupsAggregations = {};
Expand Down Expand Up @@ -432,15 +431,15 @@ ${content}
};
}

function createBaseStatsItem() {
function createBaseStatsItem(): StatItem {
return {
mean: { count: 0, total: 0 },
min: { value: Infinity, ids: [] },
max: { value: -Infinity, ids: [] },
};
}

function createBaseStatsObject() {
function createBaseStatsObject(): StatsSummary {
return {
sentences: createBaseStatsItem(),
exclamations: createBaseStatsItem(),
Expand All @@ -455,7 +454,7 @@ ${content}
};
}

function aggregatesStats(statsItem, statsObject) {
function aggregatesStats(statsItem: StatItem, statsObject: StatItem) {
statsObject.mean.total += statsItem.mean.total;
statsObject.mean.count++;
if (statsObject.min.value > statsItem.min.value) {
Expand Down Expand Up @@ -558,7 +557,7 @@ ${content}
};
}

function shrinkSummary(summary) {
function shrinkSummary(summary: StatsSummary): StatsSummary {
return {
sentences: shrinkStats(summary.sentences),
exclamations: shrinkStats(summary.exclamations),
Expand Down
28 changes: 14 additions & 14 deletions contents/globalStats.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sentences": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 1,
Expand All @@ -24,7 +24,7 @@
"exclamations": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -35,7 +35,7 @@
"2012-02-douai-notre-ville-cyril-carbonnel",
"2012-04-douai-notre-ville-jean-pierre-divrechy"
],
"restLength": 179
"restLength": 184
},
"max": {
"value": 8,
Expand All @@ -51,7 +51,7 @@
"questions": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -62,7 +62,7 @@
"2012-12-douai-notre-ville-monique-amghar",
"2013-01-douai-notre-ville-frederic-chereau"
],
"restLength": 366
"restLength": 369
},
"max": {
"value": 7,
Expand All @@ -76,7 +76,7 @@
"bolds": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -87,7 +87,7 @@
"2014-07-douai-notre-ville-guy-cannie",
"2015-02-douai-notre-ville-guy-cannie"
],
"restLength": 294
"restLength": 299
},
"max": {
"value": 5,
Expand All @@ -101,7 +101,7 @@
"caps": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -112,7 +112,7 @@
"2012-06-douai-notre-ville-karine-doyen-carbonnel",
"2012-07-douai-notre-ville-annick-louvion"
],
"restLength": 399
"restLength": 405
},
"max": {
"value": 8,
Expand All @@ -127,7 +127,7 @@
"positive": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -138,7 +138,7 @@
"2012-01-douai-notre-ville-monique-amghar",
"2012-07-douai-notre-ville-annick-louvion"
],
"restLength": 234
"restLength": 238
},
"max": {
"value": 4,
Expand All @@ -155,7 +155,7 @@
"neutral": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -177,7 +177,7 @@
"negative": {
"mean": {
"count": 13,
"total": 453
"total": 460
},
"min": {
"value": 0,
Expand All @@ -188,7 +188,7 @@
"2012-03-douai-notre-ville-jacques-vernier",
"2012-05-douai-notre-ville-jacques-vernier"
],
"restLength": 193
"restLength": 196
},
"max": {
"value": 6,
Expand Down
Loading

0 comments on commit 8717c97

Please sign in to comment.