Message Boards Message Boards

Text analysis of US political party platforms

Posted 9 years ago
Attachments:
POSTED BY: Alan Joyce
2 Replies

Great idea... I think this will do it (starting from functions and data created in the notebook above):

text = <|# -> 
      partyPlatformImporter[IDset[#]["1960"]] & /@ {"Democratic", 
     "Republican"}|>;
counts = Counts /@ (TextWords[ToLowerCase[DeleteStopwords[#]]] & /@ text);
demOnly = 
  Complement[Keys[counts["Democratic"]], Keys[counts["Republican"]]];
repOnly = 
  Complement[Keys[counts["Republican"]], Keys[counts["Democratic"]]];

Row[WordCloud[KeyTake[counts[#party], #keys], 
    ColorFunction -> ColorData[#color], ImageSize -> 400] & /@ {<|
    "party" -> "Democratic", "keys" -> demOnly, 
    "color" -> "AtlanticColors"|>, <|"party" -> "Republican", 
    "keys" -> repOnly, "color" -> "ValentineTones"|>}]

enter image description here

POSTED BY: Alan Joyce

This is interesting. How would you generate word clouds that were specific only to one party and had no overlap?

POSTED BY: heidi kellner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract