"We want to analyse which characters speak in scenes of different plays. Therefore, we extract the corresponding information from [DraCor](https://dracor.org/) and analyse it using [Formal Concept Analysis](https://www.upriss.org.uk/fca/fca.html).\n",
"We want to analyse which characters speak in scenes of different plays. Therefore, we extract the corresponding information from [DraCor](https://dracor.org/) and analyse it using [Formal Concept Analysis](https://www.upriss.org.uk/fca/fca.html) (FCA).\n",
"\n",
"## DraCor\n",
"\n",
...
...
@@ -112,7 +112,7 @@
},
{
"cell_type": "markdown",
"id": "every-capture",
"id": "durable-multimedia",
"metadata": {},
"source": [
"We use the [concepts](https://github.com/xflr6/concepts) Python library for FCA:"
...
...
@@ -121,7 +121,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "younger-playback",
"id": "ranking-island",
"metadata": {},
"outputs": [],
"source": [
...
...
%% Cell type:markdown id:economic-poker tags:
# FCA & DraCor
We want to analyse which characters speak in scenes of different plays. Therefore, we extract the corresponding information from [DraCor](https://dracor.org/) and analyse it using [Formal Concept Analysis](https://www.upriss.org.uk/fca/fca.html).
We want to analyse which characters speak in scenes of different plays. Therefore, we extract the corresponding information from [DraCor](https://dracor.org/) and analyse it using [Formal Concept Analysis](https://www.upriss.org.uk/fca/fca.html)(FCA).
## DraCor
[This simple Python library](https://pypi.org/project/dracor/) allows us to download and process plays from [DraCor](https://dracor.org/). Specifically, it allows us to extract information about which character speaks in which scene.
To create a [context](https://concepts.readthedocs.io/en/latest/api.html#context), we need a list of *objects* (we use the scenes of the play), a list of *attributes* (we use the characters of the play), and an *incidence relation* between them (in our example whether a character appears in a scene):
Finally, we can (try to) visualize the concept lattice:
%% Cell type:code id:piano-practice tags:
``` python
ctx.lattice.graphviz()
```
%% Output
<graphviz.graphs.Digraph at 0x7f3682f591f0>
%% Cell type:markdown id:announced-lawsuit tags:
... and save the context:
%% Cell type:code id:organic-cable tags:
``` python
ctx.tofile("play.cxt",frmat="cxt")
```
%% Cell type:markdown id:muslim-charity tags:
Let's test some other examples. Choose a play from the list below (recommendations: [ger/goethe-iphigenie-auf-tauris](https://dracor.org/ger/goethe-iphigenie-auf-tauris), [shake/a-midsummer-night-s-dream](https://dracor.org/shake/a-midsummer-night-s-dream)):