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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 07-22-2011, 11:05 AM   #1
lousignolo
Member
lousignolo began at the beginning.
 
lousignolo's Avatar
 
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
Words considered as articles for title sort strings

Hi.

Preferences > Tweaks > "Set the list of words considered to be "articles" for sort strings" uses the following default expression:

title_sort_articles = '^(A|The|An)\s+'

This is very useful for the English language titles.

But, because I gather both English language books and French language books in my library, I have to extend the expression, if I want to get a correct title sort for the French language books.

So, though I know strictly nothing as a programmer , I tried to extend the expression as following:

title_sort_articles = "^(A|The|An|Un|Une|L'|Le|La|Les|Des)\\s+"

I used " at the beginning and at the end of the expression, instead of ', because ' is used in the definite article L'.

This includes (links to en.wiktionary.org):
If it matches well for un, une, des, le, la, les, the expression doesn't match for the only definite article “l'”, which is, before a vowel (beginning the first adjective or the first noun in the book title, in my library) and without any space, an apocoristic form of “le” and “la”.

So I think that my expression is not the right one, because of this “space problem”, and I would really enjoy to know how I could write it to allow a right title sort for someting as:
  • “L'ultime secret” (article + adjective + noun),
  • or “L'arbre des possibles” (article + noun + other),
titles which are not sorted, now, and stay the same in 'Title sort' zone of the 'Book details' window.
lousignolo is offline   Reply With Quote
Old 07-22-2011, 12:31 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,713
Karma: 6690879
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Try
Code:
title_sort_articles = "^(A |The |An |Un |Une |L'|Le |La |Les |Des )\\s*"
chaley is offline   Reply With Quote
Advert
Old 07-22-2011, 01:11 PM   #3
lousignolo
Member
lousignolo began at the beginning.
 
lousignolo's Avatar
 
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
Quote:
Originally Posted by chaley View Post
Try
Code:
title_sort_articles = "^(A |The |An |Un |Une |L'|Le |La |Les |Des )\\s*"
Many thanks to you, chaley. It works fine.

Because of my deep ignorance, I couldn't have the idea to replace,
at the end of the string, “s+” by “s*” and to add a space after each article except after “L'”.
lousignolo is offline   Reply With Quote
Old 07-22-2011, 01:25 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by lousignolo View Post
Many thanks to you, chaley. It works fine.

Because of my deep ignorance, I couldn't have the idea to replace,
at the end of the string, “s+” by “s*” and to add a space after each article except after “L'”.
Chaley provided you with a revised "regular expression." If you wish to know more, read this:
http://manual.calibre-ebook.com/regexp.html

You don't have to know about regular expressions to use Calibre, but it comes in very handy in many places.
Starson17 is offline   Reply With Quote
Old 07-22-2011, 04:20 PM   #5
lousignolo
Member
lousignolo began at the beginning.
 
lousignolo's Avatar
 
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
Quote:
Originally Posted by Starson17 View Post
Chaley provided you with a revised "regular expression." If you wish to know more, read this:
http://manual.calibre-ebook.com/regexp.html

You don't have to know about regular expressions to use Calibre, but it comes in very handy in many places.
Lol. I know, for many years, that I should learn Python ... but I never began , being always thinking that I'm too old to learn in an easy way.
lousignolo is offline   Reply With Quote
Advert
Old 07-22-2011, 05:07 PM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,713
Karma: 6690879
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by lousignolo View Post
Lol. I know, for many years, that I should learn Python ... but I never began .
Time for a small rant.

Regular expressions are not programming. Instead, they are a linguistic tool for describing a certain class of languages called (amazingly enough) regular languages, described in (or around) 1956 by Kleene as regular sets and by Chomsky as regular grammars. Regular expressions were not used generally in computing until the late 60s, when Ken Thomson added them to the editor QED as a way to describe patterns in text. They 'took off' a few years later when he used them in the Unix editor ed, then emacs, grep, sed, awk, vi, etc.

Asserting that regular expressions are programming is equivalent to saying that sentence diagramming is programming. Both REs and diagramming describe language patterns and ways of matching expressions in a language to a pattern. Programs describe a sequence of steps a computer is to use to solve a problem. Programs can (and are) written that use regular expression 'rules' to solve problems. Programs are also written that use accounting rules to solve accounting problems, but clearly accounting is not programming. Same for regular expressions.

I am not saying that regular expressions are not complex. They are. Regular expressions are formal, in the sense that the mathematics behind them are precise. Understanding the mathematics doesn't come easy to everyone, just as understanding the mathematics behind GPS doesn't come easy to everyone (or perhaps almost anyone), but that complexity does not convert either regular expressions or the mathematics behind GPS into programming.
chaley is offline   Reply With Quote
Old 07-22-2011, 05:36 PM   #7
lousignolo
Member
lousignolo began at the beginning.
 
lousignolo's Avatar
 
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
Quote:
Originally Posted by chaley View Post
Time for a small rant.

Regular expressions are not programming. (...)
It's for me the same mistake as when people, in my 'wikipedian life', say abusively that I should be a kind of geek (roflmao), just because I have a good ability to recall and because I'm fluent in editing the wiki after years of contributions, with good knowledges of how the things are ordered in the wiki jungle.
lousignolo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I auto enter numbers to title/title sort? blu- Library Management 19 02-16-2011 01:01 PM
Author then title sort Gary Young Calibre 4 08-30-2010 10:03 PM
[Old Thread] Incorrect title sort order SkyDream Calibre 12 07-07-2010 03:03 AM
Sort by author AND title bookends Calibre 2 05-09-2010 01:55 PM
Descending title sort astrodad Calibre 14 12-23-2008 01:34 PM


All times are GMT -4. The time now is 02:49 AM.


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