09-17-2023, 07:48 AM | #1 |
Member
Posts: 10
Karma: 10
Join Date: Sep 2023
Device: Kindle
|
Kobo highlights grouped by chapter
Hello everyone, using calibre Kobo Utilies I can extract highlights of a book and the output is something like this:
Code:
The Richest Man in Babylon by George S. Clason Book last read: 2023-09-17 12:45:32 Percentage read: 23% Chapter 6: The Man Who Desired Gold Highlight Chapter progress: 18.64% Highlight: appeared at the open door. Her furtive glances in his direction reminded him that the meal bag was almost empty and he should be at work finishing the chariot—hammering and hewing, polishing and painting, stretching taut the leather over the wheel rims, preparing it for delivery—so he could collect from his wealthy customer. Nevertheless, his fat, muscular body Chapter 6: The Man Who Desired Gold Highlight Chapter progress: 18.64% Highlight: liberality, my good friend,” began Kobbi with an elaborate salute. Yet, it does appear they have already been so generous thou needest not to labor. I rejoice with thee in thy good fortune. More, I would even share it with thee. Pray, from thy purse which must be bulging else thou wouldst be busy in your shop, extract but two humble shekels and lend them to me until after the noblemen’s feast this night. Thou wilt not miss them ere they are returned.” “If I did have two shekels,” Bansir responded gloomily, Chapter 6: The Man Who Desired Gold Highlight Chapter progress: 19.49% Highlight: satisfied to work long hours and spend our earnings freely. We have earned much coin in the years that have passed, yet to know the joys that come from wealth, we must dream about them. Bah! Are we more than dumb sheep? We live in the richest city in all the world. The travelers do say none equals it in wealth. About us is much display of wealth, but of it we ourselves have naught. After half a lifetime of hard labor, thou, my best of friends, hast an empty purse and sayest to me, Chapter 7: The Richest Man in Babylon Highlight Chapter progress: 23.73% Highlight: than we. You have become the richest man in all Babylon while we struggle for existence. You can wear the finest garments and you can enjoy the rarest foods, while we must be content if we can clothe our families in raiment that is presentable and feed them as best we can. Yet once we were equal. We studied under the same master. We played in the same games. And in neither the studies nor the games did you outshine us. And in the years since, you have been Chapter 7: The Richest Man in Babylon Highlight Chapter progress: 23.73% Highlight: bare existence in the years since we were youths, it is because you either have failed to learn the laws that govern the building of wealth or else you do not observe them. Fickle Fate is a vicious goddess who brings no permanent good to anyone. On the contrary, she brings ruin to Code:
### Chapter 1 name - Highlight 1 > Eventual note to highlight 1 - Highlight 2 > Eventual note to highlight 2 - Highlight 3 > Eventual note to highlight 3 ### Chapter 2 name - Highlight 4 > Eventual note to highlight 4 - Highlight 5 > Eventual note to highlight 5 - Highlight 6 > Eventual note to highlight 6 Thank's. |
09-17-2023, 08:09 AM | #2 |
Resident Curmudgeon
Posts: 76,977
Karma: 138588794
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
No way to do as you want.
|
09-17-2023, 08:23 AM | #3 |
Reading till the spring
Posts: 12,529
Karma: 94058919
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
You'd need to use Regex in a suitable text editor, like Notepad++ on Windows (no relation to Windows Notepad), or a wide range of editors on Linux. I don't know which text editor on Mac, but likely there is one for programmers that does regex.
|
09-17-2023, 08:54 AM | #4 |
Member
Posts: 10
Karma: 10
Join Date: Sep 2023
Device: Kindle
|
Regex is basically an enhanced find & replace, how can you possibly use regex to group highlights based on chapter?
|
09-17-2023, 11:45 AM | #5 |
Member
Posts: 10
Karma: 10
Join Date: Sep 2023
Device: Kindle
|
Thank's to some AI help I was able to create a code that does exactly what I want:
Python Code: Spoiler:
Sample input of highlights extracted with Kobo Utilities Spoiler:
Output: properly formatted to account even for paragraph breaks inside the highlighted text: Code:
### The Richest Man in Babylon - And lastly, you have learned to make gold work for you. You have taught yourself how to acquire money, how to keep it, and how to use it. Therefore, you are competent for a responsible position. I am becoming an old man. My sons think only of spending and give no thought to earning. My interests are great, and I fear too much for me to look after. If you will go to Nippur and look after my lands there, I shall make you my partner and you shall share in my estate.’ “So, I went to Nippur and took charge of his holdings, which were large. And because I was full of ambition - I did share in his estate as he had arranged under the law.” So spake Arkad, and when he had finished his tale, one of his friends said, “You were indeed fortunate that Algamish made of you an heir.” > Text wirh paeagraph break - I would do it. If on the seventh day I passed by without remembering, I would not say to myself, Tomorrow I will cast two pebbles which will do as well. Instead, I would retrace my steps and cast the pebble. Nor on the twentieth day would I say to myself, Arkad, this is useless. What does it avail you to cast a pebble every day? Throw in a handful and be done with it. No, I would not say that nor do it. When I set a task for myself, I complete it. Therefore, I am careful - “You had strong willpower to keep on after you lost your first year’s savings. You are unusual in that way,” > Some note - thou also will be numbered among them. Therefore, invest thy treasure with greatest caution that it be not lost. Usurious rates of return are deceitful sirens that sing but to lure the unwary upon the rocks of loss and remorse. Provide also that thy family may not want should the gods call thee to their realms. For such protection it is always possible to make provision with small payments at regular intervals. “Therefore, the provident man delays not in expectation of a large sum becoming available for such a wise purpose. Counsel with wise men. Seek the advice of men whose daily work is handling money. Let them save you from such an error as I myself made > AGAIN ### Seven Cures for a Lean Purse - “We shall now consider the first cure.” The First Cure: Start thy purse to fattening. Arkad addressed a thoughtful man in the second row. “My good friend, at what craft workest thou?” “I,” replied the > This is text wirh paragraph break ### The First Cure: Start thy purse to fattening. - Thereupon, they agreed that it was so. “Then,” continued Arkad, “if each of you desireth to build for himself a fortune, is it not wise to start by utilizing that source of wealth which he already has established?” To this they agreed. Then Arkad turned to a humble man who had declared himself an egg merchant. “If > Hello |
09-17-2023, 12:02 PM | #6 |
Reading till the spring
Posts: 12,529
Karma: 94058919
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
No, a human did it and the Open AI people scraped it.
|
Tags |
annotations, highlight text, kobo |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Libra 2 How to export highlights with chapter/location? | bookloverCA | Kobo Reader | 11 | 09-16-2023 03:00 PM |
Highlights sorted incorrectly, no chapter headings | allio | Server | 2 | 11-16-2022 09:33 PM |
Should composite columns appear in Grouped Searches? | ownedbycats | Library Management | 3 | 02-13-2021 04:43 PM |
Authors are not grouped by letter anymore | Beethovenkugel | Library Management | 5 | 01-01-2020 05:29 PM |
Export whole chapter (complete text) with highlights? | Fralippo | Marvin | 2 | 10-24-2016 08:11 PM |