Literary analysis

Alice in Wonderland

text=ExampleData[{"Text","AliceInWonderland"}]

text//StringLength

WordCloud[text]

WordCloud[DeleteStopwords[text]]

imglinks=Flatten[StringCases[Import["https://openlibrary.org/search?q=Alice+in+Wonderland&sort=editions","ImageLinks"],RegularExpression["https://covers\\.openlibrary\\.org/b/olid/.*\\.jpg"]]]

covers=Import/@imglinks;

covers

bookPageLinks=Flatten@StringCases[Import["https://openlibrary.org/search?q=Alice+in+Wonderland&sort=editions","Hyperlinks"],RegularExpression["https://openlibrary\\.org/works/.*"]];
bookPageLinks//Short

coverImageLinks=DeleteDuplicates@Flatten[Flatten[StringCases[Import[#,"ImageLinks"],RegularExpression["https://covers\\.openlibrary\\.org/.*-L\\.jpg"]]]&/@bookPageLinks];

coverImageLinks

coverImages=Import/@Cases[coverImageLinks,_String]

Sentiment analysis

data["sentiment"]=Composition[
Classify["Sentiment", #, IndeterminateThreshold->0.6]& /@ #&,
TextSentences,
ExampleData[{"Text",#}]&
]["AliceInWonderland"]

$max=Max[StringLength/@TextSentences[ExampleData[{"Text","AliceInWonderland"}]]]

Composition[
Row[{ArrayPlot[#,ImageSize-> 850, PlotLegends->Automatic, ColorFunction->"TemperatureMap"],Grid[Round[#,0.1],Dividers-> All]}]&,
With[{w = Ceiling@Sqrt@Length@TextSentences[ExampleData[{"Text","AliceInWonderland"}]]}, Partition[#, w, w, {1, 1},0]]&,
ReplaceAll[#, Tooltip[a_,b_]:> a]&,
Replace[
#,
{
	{Indeterminate, s_String} :> Tooltip[0,s],
	{"Neutral", s_String} :> Tooltip[0,s],
	{"Positive", s_String} :> Tooltip[N[StringLength[s]/$max],s],
	{"Negative", s_String} :> Tooltip[-N[StringLength[s]/$max],s]
},
{1}
]&,
Thread[{data["sentiment"],#}]&,
TextSentences,
ExampleData[{"Text",#}]&
]["AliceInWonderland"]