« first day (403 days earlier)    last day (14 days later) » 

6:36 AM
Caleb has unfrozen this room.
 
Gosh I need to get off my toushy and make this happen.
The good news is I'm kind of being forced to do roughly the same thing in another context, so I'm getting valuable experience that will make the last bits come together easier.
But until then....
Quick question for you @curiousdannii. I've got a giant pile of data in a JSON array. Each entry has assorted keys that go with it, one of which is an OSIS format reference. I need to sort the entire array using the first verse in the OSIS reference (which might be a range). Any ideas of the top of your hear? Did that BCV parser have a function that I could use as a callback for this? Have you run across doing this anywhere else? Surely I would be re-inventing the wheel to try to code something up.
 
6:59 AM
@Caleb Is each entry either a single verse or a verse range in one book? If so it should be very easy to sort.
You can use bcv_parser.translations.default.order to sort the books.
 
@curiousdannii No they are not. But I could add another key with the first verse in the set if that's the hold up, the OSIS refs are already going to be in order as far as each value goes.
@curiousdannii Okay this is sounding promising. I'll look into it.
 
@Caleb What kind of complex keys are there?
@Caleb The main thing to do now is to adapt scott's template. I started working on it, haven't had time to finish.
 
@curiousdannii [ { ...: ..., "osis": "Matt.26.41,Rom.10.9-Rom.10.11" }, ... ]
That's about as complex as it will get, in this case that entry would me sorted based on the Matt reference.
 
@Caleb Ah, okay, yeah that shouldn't be a problem at all. Split by commas, then by hyphens so that you only have one reference. Then split by periods. Then write a comparison function which checks the book, chapter, and verse in order.
(Or use a regex to cut at the first comma or hyphen)
 
7:18 AM
@curiousdannii I can handle that end. I can also add a key that has just the data I need to use for this. The data sets aren't huge (5k at the outside and it doesn't need to run frequently) but might it not be more efficient to do some sort of parsing first and just save an order key of some kind that can be numerically sorted later?
Can I get an absolute verse sequence number for an given OSIS ref from BPVP?
 
@Caleb A comparison function should be pretty efficient, especially when your data set is smallish and it's only run infrequently. It's a lot simpler than having to ensure that a second key is kept up to date.
@Caleb I don't think so. I had to make my own function for counting verses, and that was only inside of a book.
 
@curiousdannii The data set is automatically extracted anyway so that's a non-issue. And the extraction would run again any time the source data changed, which is also when a new sort would have to happen, so it's six of one, half dozen of the other.
 
@Caleb Oh well if the data is being generated anyway, I guess you might as well.
 
@curiousdannii "XXXYYYZZZ" where X in the book number, Y is the chapter, and Z is the verse, padded so a numerical sort will return them all in the absolute right order?
This is sounding easy. Time to hack on bcv_parser.translations.default.order.
@curiousdannii "XXXYYYZZZ" where X in the book number, Y is the chapter, and Z is the verse, padded so a numerical sort will return them all in the absolute right order?
 
@Caleb That should work fine.
You wouldn't even need to actually use the parser, you can just extract the list of OSIS book names and numbers
 
7:29 AM
@curiousdannii The BPRP is doing all the work of extracting references from the source text anyway ;-)
 
@Caleb If it's being stored as JSON you could just store it as a number. book_num * 1000000 + chapter * 1000 + verse
 
I'm building 2 things at once: a reverse index to put in an appendix in the back of books that lists all references in a work and what page they appeared on, plus a sidebar for an online Bible reference tool that lists every book & page in published books that talks about any of the currently displayed verses.
 
@Caleb If you want the online reference tool to account for ranges you may want to look for overlaps like the stack verse mapper does.
 
@curiousdannii Yes, I will need to account for the ranges for the online version. Right now I have to send another book to press this week and want to get this appendix in so I just need the first one from each range. The displayed label will show the range but the sort is just on the first verse.
 
8:04 AM
ref.seq = bcv.translations.default.order[match.start.b] * 1000000 + match.start.c * 1000 + match.start.v;
I don't know if I can handle this, getting a sorting version of that list turned out to be really complicated.
Thanks for the hints @curiousdannii. And with that I'm done with JavaScript for the day, it's back to Lua for me.
 
@Caleb Haha, that's some messy code :P
 
8:21 AM
@curiousdannii This might be the simplest bit yet ;-) Overall this is a steaming pile. If nothing else the identity crisis it has with half the variable names in Turkish and half in English is enough to keep most people away. If not that, 800+ lines of Makefile inception would do the job.
 
 
7 hours later…
3:38 PM
 

« first day (403 days earlier)    last day (14 days later) »