Visualizing Topics in ELH

Sun Nov 25, 2012

I was impressed with Ian Milligan’s visualizations of Canadian parliamentary debates, and I wanted to try to visualize some of the topic models I’ve been creating from JSTOR’s Data for Research.

ELH I thought would be an interesting journal to try, as it publishes articles in each issue on quite a range of literary periods, often ranging from medieval to twentieth-century material. I assumed that LDA would be likely to identify each of these periods as a topic. To test this, I downloaded the entire set of articles from JSTOR and created a fifty-topic model. From there, I wanted to chart the proportion of each topic in each document. I was able to import the data in R and use ggplot2 to create the following graph:


As you can see, many of these topics are identifiable from even two-word samples. Others show a need of lemmatizing (a slow process using the python NLTK, though effective), or of further splitting. Perhaps fifty topics is not quite enough.

The code has to transform row data to column-form in order to be efficiently sorted. It then used the ggplot2 facet_wrap feature to create the graph. I’d be happy to share it, if anyone’s interested, though it uses a for-loop, which I understand to be bad R. You also have to pre-process the JSTOR files to associate dates with the files themselves. I have a perl script for this.

For reference, here is the complete list of topics generated by MALLET:

0  love marriage lady lover woman desire young lovers passion wife sexual beauty friendship husband heart story loves relationship world
1  women female sexual male woman gender men sexuality desire feminine masculine mary sex mother lady patriarchal early domestic feminist
2  place house back scene light great description eyes passage water space sea makes night earth city landscape man day
3  body human bodies medical scientific science physical natural bodily disease nature medicine mental health physiological early yellow james john
4  renaissance english modern book bacon early thomas latin humanist elizabethan classical utopia richard sixteenth cambridge england tudor erasmus knowledge
5  world life experience human sense reality mind personal feeling consciousness imagination real vision man modern individual emotional felt feel
6  medieval english middle arthur piers green poem gawain knight play poet lancelot bat st late courtly sir hym plowman
7  american war whitman poe america political conrad public literature jim world secret adams york marlow walt united leaves german
8  moral man virtue social human character fielding nature good natural society characters sentimental sympathy hero morality tom irony action
9  yeats keats tennyson marvell poem garden art flowers herrick victorian andrew poet nymph stanza beauty swinburne idylls green myth
10 wordsworth coleridge romantic byron blake poem poetry poetic william lyrical poet romanticism prelude lines nature imagination mind book wordsworthian
11 shakespeare play hamlet scene king dramatic tragedy richard othello plays macbeth action audience act shakespearean speech tragic drama measure
12 shelley political burke revolution french mary sublime caleb revolutionary radical rousseau godwin romantic historical wollstonecraft falkland reform prometheus frankenstein
13 chaucer tale troilus medieval tales canterbury prologue wife criseyde man book fortune courtly nat pardoner story knight ye lydgate
14 social literary cultural history historical culture political text form modern discourse literature work forms individual critique critical texts reading
15 johnson pope swift dryden satire addison gulliver satiric augustan wit boswell samuel essay restoration eighteenth lines spectator satirist poem
16 narrative story narrator fiction reader history characters plot tale book romance events novels readers character stories truth fictional text
17 irish scott historical national ireland gothic scottish history english british nation waverley scotland past castle novels ancient family antiquarian
18 church religious catholic protestant religion puritan john england english reformation bishop body roman anglican ecclesiastical christian st real argument
19 language words word speech meaning text reading reader writing rhetorical linguistic style voice verbal rhetoric read speak discourse sense
20 law legal family clarissa father pamela marriage property richardson lovelace child incest daughter letter rape contract lady criminal miss
21 spenser faerie book queene allegory pastoral canto knight allegorical guyon poem colin arthur red britomart venus poet books nature
22 death life time past dead nature man memory present loss child living world natural end soul mother back voice
23 sonnet sonnets line english music lines verse song musical form lyric sound rhyme sequence italian songs stanza lyrics opera
24 woolf public lamb virginia forster society burney social room miss goldsmith evelina elia bloomsbury lily young sheridan peter house
25 english british colonial european england national crusoe imperial cultural island empire indian early foreign spanish east trade west india
26 nature human man mind natural reason world things theory thought truth ideas knowledge philosophy idea philosophical object form imagination
27 jane dickens victorian lucy austen novels david charlotte bleak miss pip sir trollope catherine wuthering emma bronte fanny lady
28 literary english century literature criticism critical history works poetry critics great writers essay art modern work eighteenth age influence
29 make good made man great life men end give put find true time left found long mind thought things
30 black white american slave hawthorne racial slavery race african melville slaves baldwin negro scarlet identity ahab hester southern sentimental
31 social economic class money society labor economy public market trade commercial poor exchange domestic wealth system private property city
32 part point view made general important time fact work kind present earlier sense passage effect form make similar found
33 joyce stephen hardy wilde bloom ulysses james tess molly artist portrait young finnegans wake ford jude chapter dorian father
34 poem poetry poet poems poetic speaker lines poets line verse stanza stevens lyric work reader thy song williams elegy
35 letter book published letters edition writing written years john printed text literary early time william wrote books work author
36 eliot george pater jewish james victorian daniel jews henry gwendolen deronda marius life jew dorothea social adam maggie middlemarch
37 dracula sterne animal tristram beckett stein shandy animals stoker yorick henry horses lucy smart murphy journey dogs mechanical uncle
38 marlowe faustus ovid epic classical virgil tamburlaine dido chapman aeneas ovidian roman hercules gods georgic hero myth aeneid georgics
39 makes power place question order suggests simply means act response relationship fact terms sense role identity claim precisely critics
40 sidney elizabethan sir pastoral lady queen elizabeth essex beowulf stella court philip arcadia ralegh earl countess sonnet poet lord
41 god christian christ spiritual religious divine man grace st holy biblical faith john bible soul sin church word doctrine
42 desire figure body object subject image text violence power representation narrative scene form relation moment pleasure trans fantasy gaze
43 political king james english royal power history john state england henry charles government politics civil court war lord public
44 image world time form vision images order structure pattern symbolic meaning movement symbol figure imagery final process physical metaphor
45 milton paradise adam god satan lost eve samson book fall poem heaven epic son evil hell divine fallen sin
46 art pound aesthetic browning painting work thoreau visual ruskin blake artist cantos ezra plate aesthetics arts museum canto paintings
47 donne hath thy doth thou john doe good elizabethan henry haue owne made sir man renaissance bee thomas world
48 play plays stage jonson drama theater audience theatrical dramatic performance comedy masque sir restoration comic theatre scene actors ben
49 translation french latin il hebrew und se di ne cf ut english dans die version sed renaissance par quod