Skip to content

Algorithms

Zoltán Kovács edited this page Mar 18, 2025 · 7 revisions

On this page you can find an explanation of the text manipulation algorithms used in bibref.

Find a given text in a Bible edition

For each book in the Bible edition, a linear search will be performed via std::string::find. Since the longest book consists of less than 175000 characters (LXX Psalms) and there is a maximum of 54 books (LXX), the speed is acceptable.

Lookup a passage in the internal database

For the given passage, a linear search will be performed in the std::vector of verses. This is usually fast since the maximum number of verses is below 2600 (for LXX Psalms, and below 1600 for other books).

Lookup a passage as tokens

The search will be performed similarly to a passage lookup in the internal database.

Find a given tokenset in a Bible edition

For each book in the Bible edition, a linear search will be performed in the std::vector of tokens for the maximum given length to be searched, then each tokenset will be checked if all required tokens are present. Since the longest book consists of less than 35000 tokens (LXX Psalms) and there is a maximum of 54 books (LXX), the speed is acceptable.

Get raw text

The text is retrieved via its starting position and length, hence the operation is immediate.