Darin Franklin Posted December 11, 2014 Share Posted December 11, 2014 I thought it would be fun to search Hebrew and Greek Bible texts with regular expressions, so I wrote a Mac app to do just that. RegexForAccordance can search any text module in Accordance (English too). http://darinfranklin.github.io/RegexForAccordance/images/Screen%20Shot%20Hebrew.png RegexForAccordance gets Unicode text from Accordance through AppleScript and then searches it line by line. Here are a few examples of what you can do. Find Greek words that end with ημι Text Module: GNT-T Range: Matt-Rev Search: \w+ημι\b Filters: Remove Diacritics Result: τιθημι, φημι, αφιημι, Συνιστημι, συμφημι Find Repeated Phrases in the Greek New Testament Text Module: GNT-T Range: Matt-Rev Option: Ignore Case Filters: None (Remove Diacritics for more matches) Search: \b(.+)\s+\1\b Result: http://darinfranklin.github.io/RegexForAccordance/images/Screen%20Shot%20Greek%20Repeated.png By including the verse reference in the search, you can produce some interesting verse lists. Find verse 3:16 in every book http://www.accordancebible.com/forums/index.php?showtopic=13286 Text Module: KJV Range: Gen-Rev Option: Include Reference Search: \b3:16\b Result: Gen 3:16, Exod 3:16, ..., Rev 3:16. Find "Tweetable" verses in ESV (140 characters or less, including the reference) http://www.accordancebible.com/forums/index.php?showtopic=14557 Text Module: ESV Range: Gen-Rev Option: Include Reference Filters: Remove Pilcrows and Trailing Spaces Search: ^.{1,140}$ Results: 18445 verses The statistics table on the right side of the search window shows the count and length of each hit, so you can do statistical studies on letters, words, or phrases. Count Hebrew Vowels in Psalm 22 Text Module: HMT-W4 Range: Ps 22 Filters: Remove Cantillation Search: . Result: http://darinfranklin.github.io/RegexForAccordance/images/Screen%20Shot%20Hebrew%20Vowels.png RegexForAccordance uses ICU Regular Expression syntax, provided by Apple. Find Palindromes in Hebrew (similar search in Accordance: http://www.accordancebible.com/Friday-Fun-Hannah-Is-A-Palindrome ) Text module: HMT-W4 Filter: Remove Cantillation and Points Search: \b(?:(\w)\w?\1|(\w)(\w)\w?\3\2|(\w)(\w)(\w)\w?\6\5\4)\b Result: 102 distinct hits Prov 30:1 דברי ׀ אגור בן־יקה המשא נאם הגבר לאיתיאל לאיתיאל ואכל׃ Find five consecutive words which begin with the letters אלהימ Text module: HMT-W4 Filter: None Search: \bא\w*\W+ל\w*\W+ה\w*\W+י\w*\W+מ\w* Result: 2 verses Zech 4:13 וַיֹּ֤אמֶר אֵלַי֙ לֵאמֹ֔ר הֲל֥וֹא יָדַ֖עְתָּ מָה־אֵ֑לֶּה וָאֹמַ֖ר לֹ֥א אֲדֹנִֽי׃ Lam 2:13 מָֽה־אֲעִידֵ֞ךְ מָ֣ה אֲדַמֶּה־לָּ֗ךְ הַבַּת֙ יְר֣וּשָׁלִַ֔ם מָ֤ה אַשְׁוֶה־לָּךְ֙ וַאֲנַֽחֲמֵ֔ךְ בְּתוּלַ֖ת בַּת־צִיּ֑וֹן כִּֽי־גָד֥וֹל כַּיָּ֛ם שִׁבְרֵ֖ךְ מִ֥י יִרְפָּא־לָֽךְ׃ ס I hope that some of you will find this useful. Its free and open source. Download it from GitHub. http://darinfranklin.github.io/RegexForAccordance/ 7 Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 11, 2014 Share Posted December 11, 2014 Hi Darin, really like this. Just a q’n. When I do the palindrome search, I get thousands of hits, not just 102. I can’t see that my setup is any different. Thoughts? Link to comment Share on other sites More sharing options...
Joe Weaks Posted December 11, 2014 Share Posted December 11, 2014 What a fun project. I look forward to checking it out, including several implementation questions I think of. Thanks for sharing. Link to comment Share on other sites More sharing options...
Λύχνις Δαν Posted December 11, 2014 Share Posted December 11, 2014 On more than one occasion I have wanted to be able to do this. Nice one. I'll have to look back over the cases I had. Thx D Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 11, 2014 Share Posted December 11, 2014 Of course, no 1 can already be done with "*ημι" But the regex really opens up some quirky and interesting possibilities. Link to comment Share on other sites More sharing options...
Anthony Sepulveda Posted December 11, 2014 Share Posted December 11, 2014 It'd be great to see this implemented in Windows as well. Would anyone know how to get chunks of unicode text by script from Accordance for Windows? 2 Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 11, 2014 Share Posted December 11, 2014 So, when I use the "\b3:16\b” and esvs it crashes every time. Link to comment Share on other sites More sharing options...
Rick Bennett Posted December 11, 2014 Share Posted December 11, 2014 This is pretty slick. Thanks for sharing. Link to comment Share on other sites More sharing options...
Darin Franklin Posted December 11, 2014 Author Share Posted December 11, 2014 When I do the palindrome search, I get thousands of hits, not just 102. I can’t see that my setup is any different. Thoughts? The palindrome search should show "4358 hits | 3666 verses" on the left side, and "102 distinct hits" on the right. Link to comment Share on other sites More sharing options...
Darin Franklin Posted December 11, 2014 Author Share Posted December 11, 2014 So, when I use the "\b3:16\b” and esvs it crashes every time. Hmm...it works on my computer (Yosemite 10.10.1). I know that it will crash Accordance with NRSVS when you do the range Gen-Rev, but ESVS is working fine. I will debug this later. Thanks. Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 11, 2014 Share Posted December 11, 2014 The palindrome search should show "4358 hits | 3666 verses" on the left side, and "102 distinct hits" on the right. This morning I get 3414 hits | 2947 verse with 89 distinct hits Here is my setup Link to comment Share on other sites More sharing options...
Joe Weaks Posted December 11, 2014 Share Posted December 11, 2014 This morning I get 3414 hits | 2947 verse with 89 distinct hits Here is my setup http://www.accordancebible.com/forums/public/style_images/master/attachicon.gifScreen Shot 2014-12-12 at 07.29.18 .png http://www.accordancebible.com/forums/public/style_images/master/attachicon.gifScreen Shot 2014-12-12 at 07.27.51 .png The program factors in the time of day in producing the results. 1 Link to comment Share on other sites More sharing options...
Darin Franklin Posted December 12, 2014 Author Share Posted December 12, 2014 This morning I get 3414 hits | 2947 verse with 89 distinct hits Here is my setup http://www.accordancebible.com/forums/public/style_images/master/attachicon.gifScreen Shot 2014-12-12 at 07.29.18 .png http://www.accordancebible.com/forums/public/style_images/master/attachicon.gifScreen Shot 2014-12-12 at 07.27.51 .png You have a leading space in front of the first \b, so you miss the words at the beginning of a line or after a maqqef. Link to comment Share on other sites More sharing options...
Darin Franklin Posted December 12, 2014 Author Share Posted December 12, 2014 So, when I use the "\b3:16\b” and esvs it crashes every time. Hi Ken. I fixed the problem. The Accordance preferences for European verse notation and SBL standard abbreviations affect the verse reference format in the AppleScript output. I am using SBL, and I suspect that you are not. I added support for all combinations. You may download version 1.0.1 now. Thanks. 2 Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 12, 2014 Share Posted December 12, 2014 Thanks Darin, for both explanations, though re the 2nd, I am not using European notation. SBL, always However, you have fixed the crash! Thanks Link to comment Share on other sites More sharing options...
Ken Simpson Posted December 12, 2014 Share Posted December 12, 2014 The program factors in the time of day in producing the results. Joe! I never knew! That’s brilliant! Link to comment Share on other sites More sharing options...
Juan D. Pinto Posted December 12, 2014 Share Posted December 12, 2014 Darin this is so great! Thank you for the work you put into it and for making it free! Link to comment Share on other sites More sharing options...
Peter Brylov Christensen Posted December 12, 2014 Share Posted December 12, 2014 (edited) I'm very impressed with this app, Darin! Thank you for taking the time making this. With kind regards Peter Christensen Oh, and for those who want to try out the app, but don't know how to work with regular expressions, the article on Wikipedia explains it nicely:http://en.wikipedia.org/wiki/Regular_expression Edited December 12, 2014 by Pchris 1 Link to comment Share on other sites More sharing options...
Anon Posted January 14, 2015 Share Posted January 14, 2015 (edited) Would the kind folks at Accordance please sherlock this, and do the honors of making this a feature of Accordance itself? I've been longing for advanced search features in the notes (as well as texts). Excellent idea, and nicely done. Edited January 14, 2015 by James Tucker 7 Link to comment Share on other sites More sharing options...
Peter Brylov Christensen Posted January 15, 2015 Share Posted January 15, 2015 Would the kind folks at Accordance please sherlock this, and do the honors of making this a feature of Accordance itself? I've been longing for advanced search features in the notes (as well as texts). Excellent idea, and nicely done. +1 This would be a really great feature. Link to comment Share on other sites More sharing options...
Matt Fredenburg Posted January 15, 2015 Share Posted January 15, 2015 Would the kind folks at Accordance please sherlock this, and do the honors of making this a feature of Accordance itself? I've been longing for advanced search features in the notes (as well as texts). Excellent idea, and nicely done. +1 Matt Link to comment Share on other sites More sharing options...
farcas Posted February 27, 2016 Share Posted February 27, 2016 Could this help with finding hebrew word play between words? E.g. Noah found favor... נח found חן...Gen 6:8 - וְנֹ֕חַ מָ֥צָא חֵ֖ן בְּעֵינֵ֥י יְהוָֽה׃ פ http://http://www.accordancebible.com/forums/topic/17844-searching-for-hebrew-word-play/ Thanks! Link to comment Share on other sites More sharing options...
Darin Franklin Posted February 28, 2016 Author Share Posted February 28, 2016 In your other post, I think you are asking how to search for two words in the same verse which have the same letters, but not in the same order. You can do this with regular expressions, but there are some complications. In RegexForAccordance, click Filters and remove cantillation and points. The commands to know for this search are \b for word boundary \w for word character (i.e., not a space or punctuation). Search for a two letter word: \b\w\w\b Now we want to capture the two letters and match another word with those same letters. Parentheses capture, and \1 and \2 represent what was captured. The .* matches 0 or more of any character. \b(\w)(\w)\b.*\b\2\1\b If you search Genesis, you will find a lot of hits with אל... לא. In fact, the only one that isn't like that is your example of Gen 38:7: ער בכור יהודה רע Notice that it does not find Gen 6:8. ונח מצא חן בעיני יהוה׃ פ That is due to two complications. 1. נח does not begin at a word boundary because of the ו prefix. 2. חן has a final form nun. Final form and medial form are different Unicode characters, so they do not match each other. You could add a ו to fix the first problem: \bו(\w)(\w)\b.*\b\2\1\b That finds more hits with ואל...לא To account for final forms, you could search each one separately. \bונ(\w)\b.*\b\1ן\b That finds Gen 6:8 and nothing else in the whole OT. This search can be extended to three character words by adding one more (\w) to the beginning and \3 to the end. \b(\w)(\w)(\w)\b.*\b\3\2\1\b Then you will probably want to check for the other permutations, not just reverse order. \b(\w)(\w)(\w)\b.*\b\2\3\1\b \b(\w)(\w)(\w)\b.*\b\1\3\2\b Link to comment Share on other sites More sharing options...
farcas Posted March 14, 2016 Share Posted March 14, 2016 This is great! Thanks. Wish this could be integrated into Accordance searches! The best I can come up with is searching for two words that contain the same characters, but I can't specify the order. Any work around within Accordance lex data...? Thanks! Link to comment Share on other sites More sharing options...
Fabian Posted March 13, 2017 Share Posted March 13, 2017 (edited) Hello Darin I have a request after a search in RegexforAccordance and in Accordance I got different counts of hits. See like https://www.accordancebible.com/forums/topic/20885-searching-for-a-word-based-upon-its-location-in-the-verse/?p=101503 and ^And in Mark. I have seen that in different Verses the ESV has a superscript after the verse numbering. I would love to have to filter this. Greetings Fabian Edited March 13, 2017 by Fabian Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now