Zen Buddhism & Existentialism Visualized w/ Networks

Nicely done, @Rohit Namjoshi ! But now, to fix all the issues, we must embark on some journey… Let’s do this one step at a time. Get the text and words:

text=Import["http://dhspriory.org/kenny/PhilTexts/Sartre/BeingAndNothingness.pdf","Plaintext"];
words=TextWords[text];

Use @Marco Thiel’s function from the post you linked:

stopWords=ToLowerCase[WordList["Stopwords"]];
myDeleteStopwords[list_]:=Select[list,!MemberQ[stopWords,#]&]

to process hyphenated words properly

newTEXT = words // ToLowerCase // myDeleteStopwords // StringRiffle;

Note, StringRiffle makes text from words agin as KeywordsGraph takes text, not list of words - maybe something to fix in future… Now you see those hyphenated words were very important, like for-itself and in-itself are special terms:

newTEXT // TextWords // Counts // TakeLargest[#, 12] &

<|for-itself->1509,world->1437,consciousness->1385,fact->947,object->916,relation->859,freedom->829,nothingness->811,body->722,in-itself->700,order->660,past->652|>

Redefine styles with “StopWords” and “LowerCase” both False as we do not need them anymore:

styles={
VertexLabelStyle->Directive[GrayLevel[.8],15],
EdgeStyle->Opacity[.3],
VertexSize->"VertexWeight",
GraphStyle->"Prototype",
VertexLabels -> Placed[Automatic, Above],
Background->Black,
"StopWords"->False,
"LowerCase"->False};

Do some research with CMD-SHIFT-E to understand it is not just an empty string, but some strange symbol that got in from the PDF file:

Cell[BoxData["\"\<\.01\>\""], "Input"]

Now go fancy, add FindGraphCommunities to be able to specify method of clustering:

CommunityGraphPlot[#,FindGraphCommunities[#,Method->"Modularity"],
PlotLabel->Style["Being and Nothingness",50,Lighter@Red,FontFamily->"Phosphate"],
CommunityBoundaryStyle->Directive[Yellow,Dashed,Opacity[.5]],
CommunityRegionStyle->Directive[Gray,Opacity[.3]],
ImageSize->1000{1,1}]&@
ResourceFunction["KeywordsGraph"][newTEXT,45,{"","other's"},styles]

Click on image to magnify and zoom:

2 Likes