Hi! I extracted book titles from a CSV file. I am only testing now with 6 titles (they are from a specific research area). When I run the WordCloud function on the file with the 6 book titles, I did not retrieve a WordCloud image. Instead, the 6 titles were just listed horizontally in the image. What did I do wrong?
Thank you so much for your time!
data1 = Import[ "/Documents//Test.csv", {"Data", All, 5}] (*column 5*)
WordCloud[data1]
Hi Rohit,
Thank you!
I am sorry. I sent the image because when I copied and pasted, the preview looked different from what I have in the program. Here it is:
{"Artifical Light-Driven Chiral Molecular Switches Based on \
Halogenated and Cyclic Azo-Binaphthyl Derivatives", "Using Light to \
Study Liquid Crystals and Using Liquid Crystals to Control Light", \
"Design and Synthesis of Novel Liquid Crystals and Organic \
Semiconductors", "Responsive liquid crystal films and fibers", \
"NEMATIC LIQUID CRYSTAL GUEST-HOST SYSTEM FOR EYEWEAR AND RANDOM \
LASER APPLICATIONS", "Defect structure and dynamics in liquid \
crystals"}
Now the problem is clear. It is a list of string. Convert it to a single string
s = {"Artifical Light-Driven Chiral Molecular Switches Based on Halogenated and Cyclic Azo-Binaphthyl Derivatives","Using Light to Study Liquid Crystals and Using Liquid Crystals to Control Light", "Design and Synthesis of Novel Liquid Crystals and Organic Semiconductors","Responsive liquid crystal films and fibers", "NEMATIC LIQUID CRYSTAL GUEST-HOST SYSTEM FOR EYEWEAR AND RANDOM LASER APPLICATIONS","Defect structure and dynamics in liquid crystals"}
WordCloud@StringRiffle@s
May I ask a follow up question?
I am aware that in WordCloud, the size of an element is based on the number of occurrences.
But is there a way to list the top 5 or 10 most occurred elements/words?
Thank you!
Hi Rohit,
I am still learning how to do text analysis. So I am testing with a few titles. These are in fact dissertation titles. My purpose is to identify research trends with text analysis.
Hope my explanation makes sense. Thank you!
Hi Rohit, can you help me figure out something else? Thank you very much!
My original data is data1={title1, title2, title 3} (extracted from a csv file)
After I copied and pasted this data into the discussion forum, it appeared as {“title1”,“title 2”, “title 3”}
WordCloud@StringRiffle@s works well.
WordCloud@StringRiffle@data1 does not work.
What should I do?
I am not sure what you mean by “does not work”. Were you expecting that “title 2” would be treated as a single element rather than “title” and “2”? If you want that, remove the StringRiffle. But with long titles it is probably not what you want because that was the original question you asked.