Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 07-27-2022, 06:14 AM   #1
zhliu0124
Member
zhliu0124 began at the beginning.
 
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!
zhliu0124 is offline   Reply With Quote
Old 07-27-2022, 07:09 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
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
Karellen is offline   Reply With Quote
Advert
Old 07-27-2022, 07:54 AM   #3
Barbara1955
Non-Techy
Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.Barbara1955 ought to be getting tired of karma fortunes by now.
 
Barbara1955's Avatar
 
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!!
Barbara1955 is offline   Reply With Quote
Old 07-27-2022, 07:18 PM   #4
zhliu0124
Member
zhliu0124 began at the beginning.
 
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:
Originally Posted by Karellen View Post
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
zhliu0124 is offline   Reply With Quote
Old 07-27-2022, 08:05 PM   #5
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by zhliu0124 View Post
How could I mark the words in batches, if I have a list of words available? Thank you!
I am assuming you know how to use the Editor.

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?
Karellen is offline   Reply With Quote
Advert
Old 07-27-2022, 08:36 PM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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;
}
So even if the text is not highlighted, it will be sans-serif and bold so you'll notice it.
JSWolf is offline   Reply With Quote
Old 07-27-2022, 08:46 PM   #7
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
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;
}
although on a B&W ereader, it will be a light grey instead of yellow.
Karellen is offline   Reply With Quote
Old 07-27-2022, 09:02 PM   #8
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
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
Attached Thumbnails
Click image for larger version

Name:	Snippet.JPG
Views:	287
Size:	20.4 KB
ID:	195373  
theducks is offline   Reply With Quote
Old 07-27-2022, 09:41 PM   #9
zhliu0124
Member
zhliu0124 began at the beginning.
 
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.
zhliu0124 is offline   Reply With Quote
Old 07-27-2022, 11:13 PM   #10
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by zhliu0124 View Post
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.
You mean a bunch of different words?

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?
Karellen is offline   Reply With Quote
Old 07-28-2022, 12:44 AM   #11
zhliu0124
Member
zhliu0124 began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Aug 2017
Device: Kindle Paperwhite 3
Quote:
Originally Posted by Karellen View Post
You mean a bunch of different words?

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?
Yes, they are different words. Thank you for clarifying it for me.

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.
zhliu0124 is offline   Reply With Quote
Old 07-28-2022, 08:52 AM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
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.
JSWolf is offline   Reply With Quote
Old 07-28-2022, 10:41 AM   #13
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
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
And the replace would be:
Code:
<mark>\1</mark>
It is a bit clumsy, but, you can make a fairly long search and save it for reuse. But, you don't want to run that twice on the same book. It will wrap the words in a second set of tags. Remove them first.

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
davidfor is offline   Reply With Quote
Old 07-28-2022, 04:32 PM   #14
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
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]
lomkiri is offline   Reply With Quote
Old 07-28-2022, 07:56 PM   #15
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by zhliu0124 View Post
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!
FWIW - if you have Word (2007 on) you could convert the book to DOCX and use the Mark feature of Toxaris' eBook Tools MS Word add-in and then convert the DOCX back to EPUB.

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.
BetterRed is online now   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 01:22 AM.


MobileRead.com is a privately owned, operated and funded community.