bibledit-development
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [be] Project Notes: 'center around current reference': great tool


From: Teus Benschop
Subject: Re: [be] Project Notes: 'center around current reference': great tool
Date: Fri, 29 Aug 2008 20:13:44 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080707)

Hi Wolfgang,

The answers to your questions are easiest taken from the source code of that particular bit where the sorting takes place.

An extract of that code is inserted below:

    // Storage for sorting purposes.
    vector<ustring> references;
    vector<ustring> allreferences;
    vector<int> dates;
    vector<int> distances;
    set<gint32> already_stored_ids;
    // Read all resulting data from the db. Make further selections.
    for (unsigned int rc = 0; rc < sqlitereader.ustring0.size(); rc++) {
      // Get id.
      gint32 id = convert_to_int (sqlitereader.ustring0[rc]);
      // Parse the string into its possible several references.
      Parse parse (sqlitereader.ustring1[rc]);
      // Get the first numerical equivalent of the reference.
      ustring reference;
      if (parse.words.size()> 0) reference = parse.words[0];
      // Calculate the smallest distance between note and reference.
      // Also see if the cursor must be positioned here.
      int smallest_distance = G_MAXINT;
      int smallest_absolute_distance = G_MAXINT;
      for (unsigned int p = 0; p < parse.words.size(); p++) {
        int distance = convert_to_int (parse.words[p]) - numerical_currentreference;
        int absolute_distance = ABS (distance);
        if (absolute_distance < smallest_absolute_distance) {
          smallest_distance = distance;
          smallest_absolute_distance = absolute_distance;
        }
        if (absolute_distance < minimum_cursor_distance) {
          minimum_cursor_distance = absolute_distance;
          id_cursor = id;
        }
      }
    }
    // Sort the notes.
    if (settings->genconfig.notes_display_center_around_reference_get ()) {
      quick_sort (distances, ids, 0, distances.size());
    } else {
      notes_sort (ids, references, allreferences, dates);
    }

In plainer English it means the following:
- A selection of notes is read from the database.
- The lowest reference in that note is considered. E.g. if it is Mat. 10:2-10, then Mat. 10:2 is considered.
- The distance between the reference of that note and the reference of the cursor is calculated.
- The notes are sorted on that distance, so that those far before the cursor come first, then those that are nearer the cursor, then those that are at the cursor, then those that follow the cursor, and lastly those that are far ahead of the cursor.
- Finally the cursor is placed at the note that has the exact reference of the cursor.

I hope that this helps a bit, and also I hope that the reality agrees somehow to the code as explained above.

Regards,

Teus.




Wolfgang Stradner E wrote:
Hi Teus,

I tried to figure out the allgorithm of how BE orders those references and making the test below, I have some questions (see ??), how this order is built/determined:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Bibledit (BE): Scripture Processing tool in Linux


Bibledit
has a feature which has the power to be developed into a discourse navigation tool.

This tool is described BE 3.3.58/Help/Tools/View/Notes display: (olh_view_project_notes.html):
'"Order center around current reference". When this is ticked, Bibledit makes an attempt to display notes ordered by how close they are to the current reference. That is, for example, if the user display Matthew 10:2, then the notes that are nearest this reference are displayed visibly, and notes further away are moved away a bit.' 

The tool: 'center around current reference' of the 'Show project Notes' dialog box of Menu/View/Project Notes includes also notes with a reference-span (begin and end-reference). This is similar to discourse elements, which usually have reference-span.
How does this 'center around current reference' tool work, in which order are verse(-cluster)s displayed?

Example: for verses 10 - 20 (arbitrarily chosen) divided into 5 sublevels

Structure of the verse(-clusters)

 10 - 20  10 - 16  10 - 12  11


 13 - 16  13 - 14


   15 - 16  15 

 17



 18 - 20  18



 19 - 20


Display in BE

Those verse(-cluster)s are displayed in the following way, which I (not BE) mark (for better understanding) in the following way:
- current verse:  in strike-through
- verse(-cluster)s containing the actual verse: in bold
- smallest verse(-cluster)s containing the actual verse: in underline

 Reference Sort  Sort by 'center around current reference', sort at current verse: marked by strike-through
 10  11  12  13, 14  15  16  17  18   19, 20
 10 - 20  10 - 20  10 - 20  11  11
 11
 11   11
 11  11
 10 - 16  10 - 16  10 - 16  10 - 20   10 - 12  10 - 12  10 - 12   10 - 12  10 - 12  10 - 12
 10 - 12  10 - 12  11  10 - 16  13 - 16  13 - 14 13 - 14   13 - 14   13 - 14   13 - 14 
 11  11  10 - 12  10 - 12  10 - 20  10 - 16  10 - 16  10 - 16   10 - 16   10 - 16
 13 - 16  13 - 14  13 - 14  13 - 14  10 - 16  15 - 16  15 - 16  15 - 16   15 - 16  15 - 16
 13 - 14  13 - 16   13 - 16  13 - 16  13 - 14  13 - 16  13 - 16  13 - 16  13 - 16   16 
 15 - 16  15 - 16  15 - 16  15 - 16  15 - 16  10 - 20  10 - 20  16  16  13 - 16 
 16  16  16  16  16  16  16  17  17   17
 17  17  17  17  17  17  17   10 - 20  10 - 20   18
 18 - 20  18 - 20  18 - 20  18 - 20  18 - 20  18   18   18
 18  10 - 20 
 18  18  18  18  18   18 - 20   18 - 20   18 - 20  18 - 20   19 - 20
 19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20   19 - 20   19 - 20   18 - 20

RULES FOR THE ORDER OF THE UNITS:

Ordinary reference sort

a. ascending by initial or single verse
b. in case of verse-clusters: descending by end-verse 

Reference centered sort
1. Verse(-cluster)s containing the actual verse:
- 1a: Verse(-cluster)s containing the actual verse show up together
- 1b: initial verse-sort ??:  (e.g. 10-16, 15-16, 13-16, 10-20, 16)
- 1c: final verse-sort ?? (e.g. 10-20, 18, 18-20)

2. Verse(-cluster)s preceeding the verse(-cluster)s containing the actual verse: 
a. ascending by final or single verse (e.g.: 11, 10 - 12, 13 - 14, 10 - 16, 15 - 16, 16)
b. verse-clusters with same final verse: ?? (e.g. 10 - 16, 15 - 16, 13 - 16)
c. verse-cluster and verse with same final or single verse: ?? (e.g. 15-16, 13-16, 16 but also 15-16, 16, 13-16)

3. Verse(-cluster)s following the verse(-cluster)s containing the actual verse: 
a. ascending by initial or single verse (e.g.: 15 - 16, 16, 17, 18 - 20, 18)
b. several verse-clusters with same initial verse: ascending by end-verse (e.g.: 13-14, 13-16)
c. verse-cluster and verse with same initial or single verse: ??  (e.g. 18-20, 18  but also  18, 18-20)


Remark: Personal notes for splitted verses cannot be created:  #8568 Project notes: Allow splitted verses

----------------------------------------------------------------------------------------------------------------------------------------------------



Teus Benschop wrote:
Hi Wolfgang,

I am glad to hear that it works well. I hadn't paid much attention to that feature as of late. It is good to hear that the tool still behaves well. No external system is used to order these by reference, but just some internal code that does it.

Bibledit (BE): Scripture Processing tool in Linux


Bibledit
has a feature which has the power to be developed into a discourse navigation tool.

This tool is described BE 3.3.58/Help/Tools/View/Notes display: (olh_view_project_notes.html):
'"Order center around current reference". When this is ticked, Bibledit makes an attempt to display notes ordered by how close they are to the current reference. That is, for example, if the user display Matthew 10:2, then the notes that are nearest this reference are displayed visibly, and notes further away are moved away a bit.' 

The tool: 'center around current reference' of the 'Show project Notes' dialog box of Menu/View/Project Notes includes also notes with a reference-span (begin and end-reference). This is similar to discourse elements, which usually have reference-span.
How does this 'center around current reference' tool work, in which order are verse(-cluster)s displayed?

Example: for verses 10 - 20 (arbitrarily chosen) divided into 5 sublevels

Structure of the verse(-clusters)

 10 - 20  10 - 16  10 - 12  11


 13 - 16  13 - 14


   15 - 16  15 

 17



 18 - 20  18



 19 - 20


Display in BE

Those verse(-cluster)s are displayed in the following way, which I (not BE) mark (for better understanding) in the following way:
- current verse:  in strike-through
- verse(-cluster)s containing the actual verse: in bold
- smallest verse(-cluster)s containing the actual verse: in underline

 Reference Sort  Sort by 'center around current reference', sort at current verse: marked by strike-through
 10  11  12  13, 14  15  16  17  18   19, 20
 10 - 20  10 - 20  10 - 20  11  11
 11
 11   11
 11  11
 10 - 16  10 - 16  10 - 16  10 - 20   10 - 12  10 - 12  10 - 12   10 - 12  10 - 12  10 - 12
 10 - 12  10 - 12  11  10 - 16  13 - 16  13 - 14 13 - 14   13 - 14   13 - 14   13 - 14 
 11  11  10 - 12  10 - 12  10 - 20  10 - 16  10 - 16  10 - 16   10 - 16   10 - 16
 13 - 16  13 - 14  13 - 14  13 - 14  10 - 16  15 - 16  15 - 16  15 - 16   15 - 16  15 - 16
 13 - 14  13 - 16   13 - 16  13 - 16  13 - 14  13 - 16  13 - 16  13 - 16  13 - 16   16 
 15 - 16  15 - 16  15 - 16  15 - 16  15 - 16  10 - 20  10 - 20  16  16  13 - 16 
 16  16  16  16  16  16  16  17  17   17
 17  17  17  17  17  17  17   10 - 20  10 - 20   18
 18 - 20  18 - 20  18 - 20  18 - 20  18 - 20  18   18   18
 18  10 - 20 
 18  18  18  18  18   18 - 20   18 - 20   18 - 20  18 - 20   19 - 20
 19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20   19 - 20   19 - 20   18 - 20

RULES FOR THE ORDER OF THE UNITS:

Ordinary reference sort

a. ascending by initial or single

Bibledit (BE): Scripture Processing tool in Linux


Bibledit
has a feature which has the power to be developed into a discourse navigation tool.

This tool is described BE 3.3.58/Help/Tools/View/Notes display: (olh_view_project_notes.html):
'"Order center around current reference". When this is ticked, Bibledit makes an attempt to display notes ordered by how close they are to the current reference. That is, for example, if the user display Matthew 10:2, then the notes that are nearest this reference are displayed visibly, and notes further away are moved away a bit.' 

The tool: 'center around current reference' of the 'Show project Notes' dialog box of Menu/View/Project Notes includes also notes with a reference-span (begin and end-reference). This is similar to discourse elements, which usually have reference-span.
How does this 'center around current reference' tool work, in which order are verse(-cluster)s displayed?

Example: for verses 10 - 20 (arbitrarily chosen) divided into 5 sublevels

Structure of the verse(-clusters)

 10 - 20  10 - 16  10 - 12  11


 13 - 16  13 - 14


   15 - 16  15 

 17



 18 - 20  18



 19 - 20


Display in BE

Those verse(-cluster)s are displayed in the following way, which I (not BE) mark (for better understanding) in the following way:
- current verse:  in strike-through
- verse(-cluster)s containing the actual verse: in bold
- smallest verse(-cluster)s containing the actual verse: in underline

 Reference Sort  Sort by 'center around current reference', sort at current verse: marked by strike-through
 10  11  12  13, 14  15  16  17  18   19, 20
 10 - 20  10 - 20  10 - 20  11  11
 11
 11   11
 11  11
 10 - 16  10 - 16  10 - 16  10 - 20   10 - 12  10 - 12  10 - 12   10 - 12  10 - 12  10 - 12
 10 - 12  10 - 12  11  10 - 16  13 - 16  13 - 14 13 - 14   13 - 14   13 - 14   13 - 14 
 11  11  10 - 12  10 - 12  10 - 20  10 - 16  10 - 16  10 - 16   10 - 16   10 - 16
 13 - 16  13 - 14  13 - 14  13 - 14  10 - 16  15 - 16  15 - 16  15 - 16   15 - 16  15 - 16
 13 - 14  13 - 16   13 - 16  13 - 16  13 - 14  13 - 16  13 - 16  13 - 16  13 - 16   16 
 15 - 16  15 - 16  15 - 16  15 - 16  15 - 16  10 - 20  10 - 20  16  16  13 - 16 
 16  16  16  16  16  16  16  17  17   17
 17  17  17  17  17  17  17   10 - 20  10 - 20   18
 18 - 20  18 - 20  18 - 20  18 - 20  18 - 20  18   18   18
 18  10 - 20 
 18  18  18  18  18   18 - 20   18 - 20   18 - 20  18 - 20   19 - 20
 19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20   19 - 20   19 - 20   18 - 20

RULES FOR THE ORDER OF THE UNITS:

Ordinary reference sort

a. ascending by initial or single verse
b. in case of verse-clusters: desc

Bibledit (BE): Scripture Processing tool in Linux


Bibledit
has a feature which has the power to be developed into a discourse navigation tool.

This tool is described BE 3.3.58/Help/Tools/View/Notes display: (olh_view_project_notes.html):
'"Order center around current reference". When this is ticked, Bibledit makes an attempt to display notes ordered by how close they are to the current reference. That is, for example, if the user display Matthew 10:2, then the notes that are nearest this reference are displayed visibly, and notes further away are moved away a bit.' 

The tool: 'center around current reference' of the 'Show project Notes' dialog box of Menu/View/Project Notes includes also notes with a reference-span (begin and end-reference). This is similar to discourse elements, which usually have reference-span.
How does this 'center around current reference' tool work, in which order are verse(-cluster)s displayed?

Example: for verses 10 - 20 (arbitrarily chosen) divided into 5 sublevels

Structure of the verse(-clusters)

 10 - 20  10 - 16  10 - 12  11


 13 - 16  13 - 14


   15 - 16  15 

 17



 18 - 20  18



 19 - 20


Display in BE

Those verse(-cluster)s are displayed in the following way, which I (not BE) mark (for better understanding) in the following way:
- current verse:  in strike-through
- verse(-cluster)s containing the actual verse: in bold
- smallest verse(-cluster)s containing the actual verse: in underline

 Reference Sort  Sort by 'center around current reference', sort at current verse: marked by strike-through
 10  11  12  13, 14  15  16  17  18   19, 20
 10 - 20  10 - 20  10 - 20  11  11
 11
 11   11
 11  11
 10 - 16  10 - 16  10 - 16  10 - 20   10 - 12  10 - 12  10 - 12   10 - 12  10 - 12  10 - 12
 10 - 12  10 - 12  11  10 - 16  13 - 16  13 - 14 13 - 14   13 - 14   13 - 14   13 - 14 
 11  11  10 - 12  10 - 12  10 - 20  10 - 16  10 - 16  10 - 16   10 - 16   10 - 16
 13 - 16  13 - 14  13 - 14  13 - 14  10 - 16  15 - 16  15 - 16  15 - 16   15 - 16  15 - 16
 13 - 14  13 - 16   13 - 16  13 - 16  13 - 14  13 - 16  13 - 16  13 - 16  13 - 16   16 
 15 - 16  15 - 16  15 - 16  15 - 16  15 - 16  10 - 20  10 - 20  16  16  13 - 16 
 16  16  16  16  16  16  16  17  17   17
 17  17  17  17  17  17  17   10 - 20  10 - 20   18
 18 - 20  18 - 20  18 - 20  18 - 20  18 - 20  18   18   18
 18  10 - 20 
 18  18  18  18  18   18 - 20   18 - 20   18 - 20  18 - 20   19 - 20
 19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20  19 - 20   19 - 20   19 - 20   18 - 20

RULES FOR THE ORDER OF THE UNITS:

Ordinary reference sort

a. ascending by initial or single verse
b. in case of verse-clusters: descending by end-verse 

Reference centered sort
1. Verse(-cluster)s containing the actual verse:
- 1a: Verse(-cluster)s containing the actual verse show up together
- 1b: initial verse-sort ??:  (e.g. 10-16, 15-16, 13-16, 10-20, 16)
- 1c: final verse-sort ?? (e.g. 10-20, 18, 18-20)

2. Verse(-cluster)s preceeding the verse(-cluster)s containing the actual verse: 
a. ascending by final or single verse (e.g.: 11, 10 - 12, 13 - 14, 10 - 16, 15 - 16, 16)
b. verse-clusters with same final verse: ?? (e.g. 10 - 16, 15 - 16, 13 - 16)
c. verse-cluster and verse with same final or single verse: ?? (e.g. 15-16, 13-16, 16 but also 15-16, 16, 13-16)

3. Verse(-cluster)s following the verse(-cluster)s containing the actual verse: 
a. ascending by initial or single verse (e.g.: 15 - 16, 16, 17, 18 - 20, 18)
b. several verse-clusters with same initial verse: ascending by end-verse (e.g.: 13-14, 13-16)
c. verse-cluster and verse with same initial or single verse: ??  (e.g. 18-20, 18  but also  18, 18-20)


Remark: Personal notes for splitted verses cannot be created:  #8568 Project notes: Allow splitted verses ending by end-verse 

Reference centered sort
1. Verse(-cluster)s containing the actual verse:
- 1a: Verse(-cluster)s containing the actual verse show up together
- 1b: initial verse-sort ??:  (e.g. 10-16, 15-16, 13-16, 10-20, 16)
- 1c: final verse-sort ?? (e.g. 10-20, 18, 18-20)

2. Verse(-cluster)s preceeding the verse(-cluster)s containing the actual verse: 
a. ascending by final or single verse (e.g.: 11, 10 - 12, 13 - 14, 10 - 16, 15 - 16, 16)
b. verse-clusters with same final verse: ?? (e.g. 10 - 16, 15 - 16, 13 - 16)
c. verse-cluster and verse with same final or single verse: ?? (e.g. 15-16, 13-16, 16 but also 15-16, 16, 13-16)

3. Verse(-cluster)s following the verse(-cluster)s containing the actual verse: 
a. ascending by initial or single verse (e.g.: 15 - 16, 16, 17, 18 - 20, 18)
b. several verse-clusters with same initial verse: ascending by end-verse (e.g.: 13-14, 13-16)
c. verse-cluster and verse with same initial or single verse: ??  (e.g. 18-20, 18  but also  18, 18-20)


Remark: Personal notes for splitted verses cannot be created:  #8568 Project notes: Allow splitted verses verse
b. in case of verse-clusters: descending by end-verse 

Reference centered sort
1. Verse(-cluster)s containing the actual verse:
- 1a: Verse(-cluster)s containing the actual verse show up together
- 1b: initial verse-sort ??:  (e.g. 10-16, 15-16, 13-16, 10-20, 16)
- 1c: final verse-sort ?? (e.g. 10-20, 18, 18-20)

2. Verse(-cluster)s preceeding the verse(-cluster)s containing the actual verse: 
a. ascending by final or single verse (e.g.: 11, 10 - 12, 13 - 14, 10 - 16, 15 - 16, 16)
b. verse-clusters with same final verse: ?? (e.g. 10 - 16, 15 - 16, 13 - 16)
c. verse-cluster and verse with same final or single verse: ?? (e.g. 15-16, 13-16, 16 but also 15-16, 16, 13-16)

3. Verse(-cluster)s following the verse(-cluster)s containing the actual verse: 
a. ascending by initial or single verse (e.g.: 15 - 16, 16, 17, 18 - 20, 18)
b. several verse-clusters with same initial verse: ascending by end-verse (e.g.: 13-14, 13-16)
c. verse-cluster and verse with same initial or single verse: ??  (e.g. 18-20, 18  but also  18, 18-20)


Remark: Personal notes for splitted verses cannot be created:  #8568 Project notes: Allow splitted verses
Regards,

Teus.

Wolfgang Stradner E wrote:
Hi Teus,

The tool 'center around current reference' in Project Notes does a great job.
I tested it out in order to find the algorithm: Was this your idea, or do you use an add-on-programm to order the references?

Greetings
Wolfgang







reply via email to

[Prev in Thread] Current Thread [Next in Thread]