07-27-2022, 06:14 AM | #1 |
Member
Posts: 10
Karma: 10
Join Date: Aug 2017
Device: Kindle Paperwhite 3
|
How to highlight the words I'm learning in an epub file?
I'm an English learner and want to highlight the words I'm learning in the books. I'd like to ask if there is an easy way to do this, for example, making the words bold, italic, or highlighted? I can prepare a word list in a csv file.
Thanks in advance! |
07-27-2022, 07:09 AM | #2 |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
You want to embed the highlighting in the actual file, instead of annotating in the ereader? Is that correct?
If yes, then you can use the <mark></mark> tags which will highlight the words. Code:
<p>Most of the crew was <mark>baffled</mark> as to how five more teens had simply |
Advert | |
|
07-27-2022, 07:54 AM | #3 |
Non-Techy
Posts: 4,454
Karma: 15499273
Join Date: Feb 2011
Location: WV---USA
Device: Samsung Cell Phone & Amazon Fires & Kobo eReaders
|
Dont do this! I hate to read a book that other people have highlights in!!
|
07-27-2022, 07:18 PM | #4 | |
Member
Posts: 10
Karma: 10
Join Date: Aug 2017
Device: Kindle Paperwhite 3
|
Yes, I want to embed the highlights in the file so I can use them in any epub readers.
How could I mark the words in batches, if I have a list of words available? Thank you! Quote:
|
|
07-27-2022, 08:05 PM | #5 | |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Using Search and Replace... Search for baffled Replace with <mark>baffled</mark> Just repace "baffled" with whatever your word is. What happens when you read the book? Do you look up a definition when you come across the highlighted word? |
|
Advert | |
|
07-27-2022, 08:36 PM | #6 |
Resident Curmudgeon
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
<mark> does work in the Calibre editor. But not in Adobe Digital Editions 2.0.1. But what you can do that should work in all cases is this...
Code:
mark { font-family: sans-serif; font-weight: bold; } |
07-27-2022, 08:46 PM | #7 |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Oops, thanks JSWolf, forgot to mention about the css code.
If you want highlighting instead of bold you could use... Code:
mark { background-color: yellow; } |
07-27-2022, 09:02 PM | #8 |
Well trained by Cats
Posts: 29,799
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
You can add a (mark) clip to the </> menu in the Editor
Simply select the word (double click on it for single words, then click the clipname you made |
07-27-2022, 09:41 PM | #9 |
Member
Posts: 10
Karma: 10
Join Date: Aug 2017
Device: Kindle Paperwhite 3
|
Thank you, guys! This is very helpful!
My other question is how I can modify a bunch of words automatically. It would be tedious to do it one by one. |
07-27-2022, 11:13 PM | #10 | |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
I suppose you could use a Regex-function, but I don't know how to do it. Others will need to help out. How many different words? |
|
07-28-2022, 12:44 AM | #11 | |
Member
Posts: 10
Karma: 10
Join Date: Aug 2017
Device: Kindle Paperwhite 3
|
Quote:
The word list includes those words I don't familiar with, which is about 30k long. I want those words to be highlighted in the books so I will pay more attention to them while I'm reading the books. |
|
07-28-2022, 08:52 AM | #12 |
Resident Curmudgeon
Posts: 73,957
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You can add <mark></mark> to the every instance of the same word in the that one eBook with a search and replace.
What you cannot do is automate this for all the words you want in all the eBooks you want. This is a manual task for each eBook. |
07-28-2022, 10:41 AM | #13 |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Of course, if you have a small set of words, you could do a search like:
Code:
\b(these|words|are|the|ones|I|want|to|mark|so|that|they|are|noticeable|when|reading)\b Code:
<mark>\1</mark> And for the record, the book I had opened for editing when I wrote this had 6515 changes when I did the above. I suspect that using "the" was a bad idea |
07-28-2022, 04:32 PM | #14 |
Zealot
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
|
You can do that with a regex-function.
Get the regex at https://regex101.com/r/4fWfX1/1 , it selects every word of 2 letters or more (you can increase this limit). Thanks to EbookMakers, he made the regex. Get the function below, and "replace all". You'll have to change the file name, and put another tag if you wish At the end of the job, there is a "debug" msg with the number of tagged words. BEWARE: The search in the function is case sensitive. If you want it insensitive, change the line 40. If you do that (case insensitive), remember that all words in the list must be lowered. BEWARE: The file used here is not a CVS one The file is build in this form : a single word by line (one line = one word to mark) If you want to use a CVS file, show me the format you used, and I'll adjust the function load_file() for you, but only tomorrow night. Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): # ============= change this if needed =============== fname = '/data/temp/words.txt' # This is for linux, find by yourself how to give the path in windows tag_begin = '<mark>' # or <span class="marked"> for exemple tag_end = '</mark>' # See also the test at line 40 if you want a search with case insensitive # ================= def load_list(fname): data['error'] = False data['nb_tagged'] = 0 try: fd = open(fname, 'r') except FileNotFoundError: print(f"File {fname} not found, or error in opening it") # raise # if we raise the error, the msg above will not be printed data['error'] = True return [] # put the file in the dict list_word = [line.strip() for line in fd] fd.close() if not list_word: print(f"File {fname} is empty") # raise # if we raise the error, the msg above will not be printed data['error'] = True return list_word if not match: # last passage print(f"Number of words tagged: {data['nb_tagged']}") return if number == 1: # first passage replace.call_after_last_match = True # ask for last passage after all occ. data['words'] = load_list(fname) # put this instead if you want insensitive search: # if not data['error'] and match[1].lower() in data['words']: if not data['error'] and match[1] in data['words']: data['nb_tagged'] += 1 return tag_begin + match[1] + tag_end return match[1] |
07-28-2022, 07:56 PM | #15 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
The Mark tool provides for multiple lists of 'words' that you could highlight in different colours (e.g. yellow for nouns, pink for verbs, green for adjectives etc). The word lists are stored in XML files, there's a tool to maintain them, or you can edit them in a text editor. BR Last edited by BetterRed; 07-28-2022 at 08:02 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I send the viewer's annotation/highlight to an epub file? | jeju2 | Library Management | 3 | 12-19-2021 09:10 PM |
How to highlight words/sentences in PDF files? | KarlVoit | Onyx Boox | 10 | 11-30-2020 08:24 AM |
How to make Balabolka highlight words instead of sentences? | MRUser | Audiobook Hardware & Software | 0 | 01-28-2018 02:17 AM |
Cant highlight/ lookup words Kindle touch | alanHd | Amazon Kindle | 10 | 08-26-2013 06:32 PM |
Kindle 3: Highlight and lookup the definitions for words not in dictionary? | ivanatpr | Amazon Kindle | 13 | 10-28-2010 09:54 AM |