We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I'm new with Processing but to learn it i wanted to do it through thesis project[tough guy]. The highlights of this one is creating a concordance book from a famous epic poem (open source too). [this poem is on txt file]
So, for every word the code should say: "count total word", "count on each chapter word" and the "verse positions".
Ex.= "Gamble = 340, Ch. 1 - 120, Ch 2 - 220. Vrs: 142, 140, 3, 5, 66, [...]."
I saw the loadString and ok, but what i don't understand is that can i do multi-loadStrings for each chapter to do a sort of delimiter for counter chapter?
First idea was to take the txt file and divide it for each chapter: Is that a right way do it?
I saw the lessons of Daniel on Youtube, very helpful [Thanks] and i bought all the books. The problem is i don't know well where to start. I'm sorry for disturbing. Grateful for your help.
Answers
have you seen this
https://forum.processing.org/two/discussion/15883/word-counter-question#latest
are the verse positions also per chapter or for the entire book?
which book is it?
is the txt file for the entire book or one txt file per chapter?
when it is one txt for the entire book obviously load the entire a book and split it up into chapters,
Have an array textsOfTheChapters[] where you store the texts
Hi Mr Chrisir. Thanks for the respond. And sorry for the bad grammar, i'm still learning the english.
Well. Starting with the first question: no haven't seen it yet. I will right now.
The verse positions are for the entire book.
The book is The Divine Comedy by Dante Alighieri.
I have both of them.
Ok, i'll do it. Thanks.
Are the txt files like
Vers Number, text ?
Then detect the comma an split i there
maybe you can use split() if it is
","
I don't get it well, but:
•I have 3 files txt corresponding each chapter: Hell, Paradise and Purgatory. [i split it in my own] •Then i have the unique [original] file that contains the whole text book. •Some line doesn't finish with comma [if i understand well]
To simplify the question here it is an example:
Thank you.
Ok, no line Numbers in the txt file
So i guess the only way is to transform it in xml. Right?
No xml is not required here
you make backup copies of all 4 txt files first
use hashmap to monitor which words you already have
here is an example - not by me
this line is what you want to achieve:
now, I think Gamble you can do with the hashMap code above
also 340 you can do
please loop through the entire book first to achieve
Gamble
340
all Verses (since The verse positions are for the entire book.)
NOW Ch. 1 - 120, Ch 2 - 220
now load Ch 1 only
(A) and keep the data you have
count
then store the count result
load Ch. 2 only
repeat the above from (A)
OOP
to be able to store the data don't use an int[] as in my example but a CLASS instead (OOP)
the class WordData holds all the data you want to collect for one word:
see on OOP
https://www.processing.org/tutorials/objects/
Many thanks Chrisir, i'll update you. Good weekend.
Hi Chrisir!
I'm back again to update you (if you are interested). I discussed with my supervisor and we changed some stuff to let them be easier to program.
I no more need to create a counter chapter 'cause we decided to split the chapters itself on each file txt.
So i only need a counter word to a-z (and this is done), and a counter verse, which should be a "counter lines(?)" (on this i'm still scraping my head and i can't find a good code).
This is a question: is this possible to export this list on a multi-pages PDF?
If you want to see where i came, i'll send you the code.
Best,
FK
when you for loop over the lines (let's say with var i), isn't just the value of i the line number = verse number?
this might get you started : https://www.processing.org/tutorials/print/
Sorry i had to be more precise: "counter verse" meaning that he have to say in which verse each word are located. Ex.: "The: 4, verse 4, 5, 6, 8."
I saw that pdf guide, and i spotted pdfbox, but even that is not good. I guess i'm going to export it without that.
Thanks anyway Chrisir.
Isn't one verse one line?
you can just write a text file, load it in MS Word, format it and save as pdf
use saveStrings
Hi Chrisir, Great news, the code is almost finished. I'll put the project here as soon as possible. Just one thing: how can i delimits words into the same string delimiter? For ex.: String delimiters = " ,.?!§\';:`()[]-\""; I want to put words or letters separated from spaces into that. Is that possible? I tried "\/s/" didn't work. Same as *example (with commas)
Spaces?
Did you try to put a space sign between ? and !
just a ? !
ah you mean this: splitTokens :
Hi Chrisir,
I made a switch and used comparator. Thanks to a friend of mine, you can also change on SortMode 3 different type of sorting. Thanks anyway Chrisir.
Edit: I know this is not what we are talking about (delimiters), i'm a bit out of mind, sorry.
I can't delimit words with that process Chrisir. I'll have to import javax.xml.parsers.*; But it takes too much time and i'll have to rewrite some stuff. I'll show you sooner why i can't. Big thanks mate.
Hi all, here we are with the first type of generator.
Well done!
Well sorry for not explaining the whole project. I need some time to translate the sheet. Anyway thanks for the support ill quote you Chrisir.
edit: i know, it is not well programmed, too many switches, but being novice with code, i guess its not bad.