Monday, December 16, 2019

Texts & Strings


corpus ={"Have you already set your goals for the New Year?",
"Do you want to lose ten kilos, run a marathon or speak fluent English?",
"Some experts believe that you need systems, not goals.",
"A system is something you do on a regular basis.",
"This means focusing on what you can control (your actions) rather than what you can not.",
"For example, do not focus on losing ten kilos.",
"Focus on shopping for healthy food and cooking something light every day.",
"Do not focus on the marathon.","Focus on the training schedule.",
"Invent a system to improve your English, one step at a time.","Good luck!"};
wcorpus=StringReplace[StringJoin[corpus], PunctuationCharacter :> " "];
wc=KeySort[WordCounts[ToLowerCase[wcorpus]]]; fc=[]

WordCloud[wcorpus,fc,WordOrientation->"Random",PlotTheme->"Web"]
BarChart[wc,ChartLabels->Placed[Normal[Keys[wc]],Axis,Rotate[#,Pi/2] &],
ChartStyle->"Pastel",ChartElementFunction->"GlassRectangle",ImageSize->600]




No comments:

Post a Comment