Spaces:
Running
Running
better presentation
Browse files- docs/gazette.md +8 -9
docs/gazette.md
CHANGED
|
@@ -1,13 +1,6 @@
|
|
| 1 |
# Gazette
|
| 2 |
|
| 3 |
-
|
| 4 |
-
import { DuckDBClient } from "npm:@observablehq/duckdb";
|
| 5 |
-
const db = DuckDBClient.of({ presse: FileAttachment("data/presse.parquet") });
|
| 6 |
-
```
|
| 7 |
-
|
| 8 |
-
This page allows you to explore the 3 million newspapers by title. I called it “Gazette” because I was surprised that most of the corpus in the earlier years had a title containing this word.
|
| 9 |
-
|
| 10 |
-
Type in words such as “jeune”, “révolution”, “république”, “matin”, “soir”, “humanité”, “nouvelle”, “moderne”, “femme”, “paysan”, “ouvrier”, “social”, “résistance” etc. to see different historical trends.
|
| 11 |
|
| 12 |
```js
|
| 13 |
const search = view(
|
|
@@ -23,6 +16,7 @@ label: `Share of titles matching ${search}`,
|
|
| 23 |
tickFormat: "%",
|
| 24 |
},
|
| 25 |
marks: [
|
|
|
|
| 26 |
Plot.areaY(base, {
|
| 27 |
x: "year",
|
| 28 |
y: ({year, total}) => gazette.get(year) / total,
|
|
@@ -38,7 +32,7 @@ curve: "step"
|
|
| 38 |
})
|
| 39 |
}
|
| 40 |
|
| 41 |
-
The query uses a case-insensitive [REGEXP_MATCHES](https://duckdb.org/docs/archive/0.9.2/sql/functions/patternmatching) operator to count occurrences; you can query for example “socialis[tm]e” to match both “socialiste” and “socialisme”.
|
| 42 |
|
| 43 |
```js echo
|
| 44 |
const results = db.query(
|
|
@@ -51,6 +45,11 @@ const results = db.query(
|
|
| 51 |
);
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
```js
|
| 55 |
// A Map for fast retrieval—precisely an InternMap, indexed by Date
|
| 56 |
const gazette = new d3.InternMap(results.map(({ year, c }) => [year, c]));
|
|
|
|
| 1 |
# Gazette
|
| 2 |
|
| 3 |
+
Explore 3 million newspapers **by title**. Type in words such as “jeune”, “révolution”, “république”, “matin”, “soir”, “humanité”, “nouvelle”, “moderne”, “femme”, “paysan”, “ouvrier”, “social”, “résistance” etc. to see different historical trends.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
```js
|
| 6 |
const search = view(
|
|
|
|
| 16 |
tickFormat: "%",
|
| 17 |
},
|
| 18 |
marks: [
|
| 19 |
+
Plot.ruleY([0, 0.01], {stroke: ["currentColor"]}),
|
| 20 |
Plot.areaY(base, {
|
| 21 |
x: "year",
|
| 22 |
y: ({year, total}) => gazette.get(year) / total,
|
|
|
|
| 32 |
})
|
| 33 |
}
|
| 34 |
|
| 35 |
+
I called this page “Gazette” because I was surprised that most of the corpus in the earlier years had a title containing this word. The query uses a case-insensitive [REGEXP_MATCHES](https://duckdb.org/docs/archive/0.9.2/sql/functions/patternmatching) operator to count occurrences; you can query for example “socialis[tm]e” to match both “socialiste” and “socialisme”.
|
| 36 |
|
| 37 |
```js echo
|
| 38 |
const results = db.query(
|
|
|
|
| 45 |
);
|
| 46 |
```
|
| 47 |
|
| 48 |
+
```js
|
| 49 |
+
import { DuckDBClient } from "npm:@observablehq/duckdb";
|
| 50 |
+
const db = DuckDBClient.of({ presse: FileAttachment("data/presse.parquet") });
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
```js
|
| 54 |
// A Map for fast retrieval—precisely an InternMap, indexed by Date
|
| 55 |
const gazette = new d3.InternMap(results.map(({ year, c }) => [year, c]));
|