07-22-2011, 11:05 AM | #1 |
Member
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:
|
07-22-2011, 12:31 PM | #2 |
Grand Sorcerer
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*" |
Advert | |
|
07-22-2011, 01:11 PM | #3 | |
Member
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
|
Quote:
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'”. |
|
07-22-2011, 01:25 PM | #4 | |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
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. |
|
07-22-2011, 04:20 PM | #5 | |
Member
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
|
Quote:
|
|
Advert | |
|
07-22-2011, 05:07 PM | #6 | |
Grand Sorcerer
Posts: 11,713
Karma: 6690879
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
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. |
|
07-22-2011, 05:36 PM | #7 |
Member
Posts: 11
Karma: 10
Join Date: Jul 2011
Location: France
Device: Archos 7 0b eReader
|
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.
|
Thread Tools | Search this Thread |
|
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 |