Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 03-03-2013, 01:29 AM   #1
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
How to use 'format' in <idx:orth> tags for dictionaries?

I'm having a really hard time trying to figure out how to use the change/format what the Kindle displays in the index of a dictionary.

This is what I would like to achieve: for a given headword, when searching in the index, display 'headword [phonetic reading]'.

Code:
<idx:entry name="word" scriptable="yes">
<h3>頭</h3>
<idx:orth format="orth 【あたま】">頭</idx:orth>; <idx:orth>首 【あたま】</idx:orth>
【あたま; かしら; かぶり; こうべ; ず; つむり; つぶり; つむ; かぶ】
<br />
(noun) (1) head; (2) mind; brain; intellect; (3) top; (4) hair (on one's head); (5) bangs; fringe; (6) top structural component of a kanji
<br />
</idx:entry>
<hr />
<br />
The format doesn't seem to be used at all. All I get displayed in the index is the value between the <idxrth> tags.

I've read the mobi documentation at http://www.mobipocket.com/dev/articl...e=indexing.htm have tried using single quotes and idx:string but nothing seems to work.

Any help or suggestions is greealty appreciated!
totsubo is offline   Reply With Quote
Old 03-03-2013, 05:27 AM   #2
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Try this:

Code:
<html>
<body>

<idx:entry>
	<idx:orth value="頭">
		<idx:infl><idx:iform value="首"/></idx:infl>
	</idx:orth>
	<h3>頭 【あたま】首 【あたま】</h3>
	【あたま; かしら; かぶり; こうべ; ず; つむり; つぶり; つむ; かぶ】<br />
	(noun) (1) head; (2) mind; brain; intellect; (3) top; (4) hair (on one's head); (5) bangs; fringe; (6) top structural component of a kanji<br />
</idx:entry>

</body>
</html>

This defines 首 as a variant of 頭 and looking up either of these Kanjis will display the same entry.
Doitsu is offline   Reply With Quote
Old 03-03-2013, 06:49 AM   #3
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
Quote:
Originally Posted by Doitsu View Post
Try this:

Code:
<idx:entry>
	<idx:orth value="頭">
		<idx:infl><idx:iform value="首"/></idx:infl>
	</idx:orth>
	<h3>頭 【あたま】首 【あたま】</h3>
	【あたま; かしら; かぶり; こうべ; ず; つむり; つぶり; つむ; かぶ】<br />
	(noun) (1) head; (2) mind; brain; intellect; (3) top; (4) hair (on one's head); (5) bangs; fringe; (6) top structural component of a kanji<br />
</idx:entry>

This defines 首 as a variant of 頭 and looking up either of these Kanjis will display the same entry.
Doitsu, thanks for the reply!

Perhaps I didn't quite explain what I wanted to do. I'll try and explain more clearly.

The issue I have is not with what the dictionary entry/definition displays, it's with what is displayed in the index list.

By this I mean when a user has the dictionary already opened and does a search within the dictionary. When you do this the Kindle displays a list of all the index entries (in alphabetical order).

[If this is still not clear let me know and I will try and upload screen shots]

Currently I have this code:

Code:
<idx:entry name="word" scriptable="yes">
  <h3>頭</h3>
  <idx:orth>頭</idx:orth>;
  <idx:orth>首</idx:orth>
  【あたま; かしら; かぶり; こうべ; ず; つむり; つぶり; つむ; かぶ】<br />

(noun) (1) head; (2) mind; brain; intellect; (3) top; (4) hair (on one's head); (5) bangs; fringe; (6) top structural component of a kanji

<br />
</idx:entry>
<hr />
<br />
Functionally this works, looking up either 頭 or 首 will bring up the entry. The difference being that my approach will display 首 in the index list but bring you to the entry for 頭 while your suggestion of using inflections will display 頭 in the index list. (*)

The problems is that in the index, what is displayed is 頭 (and only that). I would like to display the kanji *and* the reading when the index list is being displayed. In other words I would like this displayed "頭 【あたま】"

I can't find anyway of doing this that doesn't break the index. I know it can be done though because the 大辞典 dictionary that comes free with the Kindle Paperwhite does just that ...

Any suggestions are most welcomed!

(*) In case where an entry has more than one possible kanji I'm having difficulty deciding if I should use my method of multiple orth's or use inflections instead. With inflections users could get confused when doing an in-dictionary index lookup - the user is looking for 首 and the index shows 頭. Unless you already that one is an inflection of the other it can be confusing.

On the other hand, using multiple orth's also has a big drawback. 首 is an inflection (alternate writing) of 頭, but it *also* has it's entry (neck) which unrelated to 頭! Doing an index lookup will display two entries for 首, which I can live with. The issue comes up when doing a look-up when reading a book. If you look-up 首, the Kindle will jump to the entry for 頭 (head) which is incorrect ... it should have gone to 首 (neck).
totsubo is offline   Reply With Quote
Old 03-03-2013, 07:25 AM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by totsubo View Post
The problems is that in the index, what is displayed is 頭 (and only that). I would like to display the kanji *and* the reading when the index list is being displayed. In other words I would like this displayed "頭 【あたま】"
Unfortunately, I cannot help you with that, because my old K3 doesn't have the Index feature, but AFAIK, it's not possible to display both the Kanji and the Furigana in the index unless you add "頭 【あたま】" as a dummy headword or a dummy inflection, and you'd probably end up with both "頭" and "頭 【あたま】" in the Index list.

Quote:
Originally Posted by totsubo View Post
If you look-up 首, the Kindle will jump to the entry for 頭 (head) which is incorrect ... it should have gone to 首 (neck).
Unfortunately, when it comes to dictionary features the Kindle is a big step backwards because it offers fewer features than Mobipocket Reader, which will display multiple entries for one search term.
That's an unfortunate limitation of the Kindle that you can't do anything about other than complaining about it to the Kinde developers.
Doitsu is offline   Reply With Quote
Old 03-03-2013, 07:49 AM   #5
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
Quote:
Originally Posted by Doitsu View Post
Unfortunately, I cannot help you with that, because my old K3 doesn't have the Index feature, but AFAIK, it's not possible to display both the Kanji and the Furigana in the index unless you add "頭 【あたま】" as a dummy headword or a dummy inflection, and you'd probably end up with both "頭" and "頭 【あたま】" in the Index list.
I'm attaching some screenshots from the Kindle's free Japanese/Japanese dictionary. I did an index search for 頭 and it only shows one index entry for 頭【あたま】.

I can't figure out how they did it. I decompiled the dictionary and I can see that they use <idx:orth value=""> but I can't tell what the value is ... it looks like a pointer into the index file. I even opened up an index file in a hex editor, but it's unreadable.

Code:
 
<idx:entry>
  <idx:orth value="^C"A">
</idx:entry>
<b>あたま</b>【頭】<br/> <b>1</b> 動物の体の上 ...
Attached are screenshots of the index entry and the dictionary entry for 頭.
Attached Thumbnails
Click image for larger version

Name:	Index entry.png
Views:	619
Size:	39.4 KB
ID:	102261   Click image for larger version

Name:	Entry.png
Views:	521
Size:	52.0 KB
ID:	102262  

Last edited by totsubo; 03-03-2013 at 08:03 AM.
totsubo is offline   Reply With Quote
Old 03-03-2013, 10:36 AM   #6
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by totsubo View Post
I can't figure out how they did it. I decompiled the dictionary and I can see that they use <idx:orth value=""> but I can't tell what the value is ... it looks like a pointer into the index file.
Since the dictionary format hasn't been updated in ages and, AFAIK, there are no Japanese specific tags, they most likely simply defined Kanji + Furigana using idx:orth value= and the actual Kanji using idx:infl.

Code:
<html>
<body>

<idx:entry>
	<idx:orth value="二 【に】">
		<idx:infl><idx:iform value="二"/></idx:infl>
	</idx:orth>
	二 【に】<br />
	Two<br /><br />
 </idx:entry>

<idx:entry>
	<idx:orth value="頭 【ねこ】">
		<idx:infl><idx:iform value="頭"/></idx:infl>
	</idx:orth>
	頭 【ねこ】<br />
	Cat<br /><br />
 </idx:entry>

<idx:entry>
	<idx:orth value="猫 【あたま】">
		<idx:infl><idx:iform value="猫"/></idx:infl>
	</idx:orth>
	<idx:orth value="首 【あたま】">
		<idx:infl><idx:iform value="首"/></idx:infl>
	</idx:orth>
	[首 【あたま】首 【あたま】<br />
	(noun) (1) head; (2) mind; brain; intellect; (3) top; (4) hair (on one's head); (5) bangs; fringe; (6) top structural component of a kanji<br /><br />
 </idx:entry>

</body>
</html>
Does this work for you?

Last edited by Doitsu; 03-04-2013 at 10:33 AM. Reason: Removed extra spaces in code listing.
Doitsu is offline   Reply With Quote
Old 03-04-2013, 05:55 AM   #7
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
Doitsu, thanks again for the suggestions. I'm really clutching at straws so appreciate your ideas.

I've tried a version of what you suggested.

Here's the file I created:
Code:
<html>
<body>
<idx:entry name="word" scriptable="yes">
  <idx:orth value="頭 【あたま】">
    <idx:infl><idx:iform value="頭"/></idx:infl>
  </idx:orth>
  Head
</idx:entry>
</body>
</html>
The index seems to be broken. When I do a search (in the dictionary) nothing comes out, just a blank page. The entry itself can be seen if you read the dictionary though.

The documentation has this to say for the value attribute:

Quote:
Use the value attribute to include text for the label in the entry that you do not want to display in the OEB flow
I don't understand what that means very much because the documentation fails to define the terms they use. For example what's a 'label', what's an 'entry', and what is the 'OEB flow'?
totsubo is offline   Reply With Quote
Old 03-04-2013, 07:07 AM   #8
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by totsubo View Post

The index seems to be broken. When I do a search (in the dictionary) nothing comes out, just a blank page. The entry itself can be seen if you read the dictionary though.
That's strange. I tested my mini dictionary with Mobipocket Reader, which shows index entries and it seems to work. It also worked as a lookup dictionary, when I positioned the cursor before a single Kanji.

Maybe your problems are caused by the name="word" scriptable="yes" attributes.

Quote:
Originally Posted by totsubo View Post
I don't understand what that means very much because the documentation fails to define the terms they use. For example what's a 'label', what's an 'entry', and what is the 'OEB flow'?
I never used labels and I have no idea what they mean by OEB flow either, but my dictionaries usually worked just fine.

Last edited by Doitsu; 03-04-2013 at 10:01 AM.
Doitsu is offline   Reply With Quote
Old 03-04-2013, 09:03 AM   #9
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
Thanks for the files Doitsu. I used kindlegen to convert the html to a dictionary using my opf file and it works. A big thank you!

A few observations:

1- There are only three index entries. 首 doesn't show in the index

2- An index search for 首 brings up nothing, but 'clicking' on the search box's 'go to' arrow take me to the correct entry for 頭.

I did a bit more testing by adding one more entry with 3 inflections and then 首 showed up but only the first two inflections of the new entry was displayed in the index list. Very strange. Looks like the last inflection of the file is never displayed. Wonder if this is a bug with kindlegen.
totsubo is offline   Reply With Quote
Old 03-04-2013, 10:00 AM   #10
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by totsubo View Post
Looks like the last inflection of the file is never displayed. Wonder if this is a bug with kindlegen.
I had another look at my source file and noticed that there was an extra space before the closing quotation mark of the inflection defintion.

Code:
	<idx:orth value="猫 【あたま】">
		<idx:infl><idx:iform value="猫 "/></idx:infl>
	</idx:orth>
	<idx:orth value="首 【あたま】">
		<idx:infl><idx:iform value="首 "/></idx:infl>
	</idx:orth>
If you used my code as a template, you might have inadvertently copied the extraneous spaces, which will mess up the dictionary functionality.
Doitsu is offline   Reply With Quote
Old 03-04-2013, 05:51 PM   #11
totsubo
Member
totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.totsubo ought to be getting tired of karma fortunes by now.
 
Posts: 22
Karma: 475242
Join Date: Nov 2012
Device: Kindle Paperwhite
Quote:
Originally Posted by Doitsu View Post
I had another look at my source file and noticed that there was an extra space before the closing quotation mark of the inflection defintion.

If you used my code as a template, you might have inadvertently copied the extraneous spaces, which will mess up the dictionary functionality.
I did notice and fixed that but still had the same issue. I wonder if this is why I saw that my 'simple' test file with just one entry did not show any index entry? I.e. since there was only on entry it was the 'last' entry and so didn't show?

With a 'fixed' file do your reader show all index entries or just three?

I'd like to test if this is a bug with kindlegen or the Kindle itself by testing a prc file versus an azw file. Where can I get the software that you used to generate the prc (for Mac)?
totsubo is offline   Reply With Quote
Old 03-05-2013, 12:54 AM   #12
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,582
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by totsubo View Post
I'd like to test if this is a bug with kindlegen or the Kindle itself by testing a prc file versus an azw file. Where can I get the software that you used to generate the prc (for Mac)?
I used the ancient Mobipocket Creator software, which isn't available as a Mac version.

Maybe you can find an older Mac KindleGen 1.x version on the Internet.
It also couldn't hurt to test your files with the latest KindleGen 2.8.
Doitsu is offline   Reply With Quote
Old 10-30-2013, 03:28 AM   #13
Jpax
Member
Jpax began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Nov 2012
Location: Philippines
Device: Kindle Fire, Kindle Fire HD, Amazon Kindle PW, Nook Color, Nook Tablet
Hi there, does anyone here accept eDictionary conversion service. Thanks.
Jpax is offline   Reply With Quote
Reply

Tags
dictionary, format, idx, mobi, orth

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching tags to show tags I want even when it has a tag I do not Jade Aislin Library Management 2 04-25-2012 01:01 PM
Hierarchical tags and their format on book details Noughty Library Management 12 02-19-2012 07:47 AM
Amazon Tags - Popular tags vs Unique tags. chrisanthropic Writers' Corner 6 09-19-2011 11:18 PM
on converting .mobi dictionaries to pb format teofrast PocketBook 8 02-28-2011 04:26 PM
tab2opf.py <idx:key key="xxx"> Doitsu Kindle Formats 0 01-11-2011 11:57 AM


All times are GMT -4. The time now is 04:27 AM.


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