Jump to content

Searching BDAG by Semantic Domain


Λύχνις Δαν

Recommended Posts

Hi ya,

 

I was looking over a link concerning the NIDNTTE and ran into mention of Louw and Nida's lexicon again. I wondered if one could search a regular lexicon like say LSJ or BDAG using those classifications. Could I for example pick a L&N domain and then look up all those words in BDAG. It seems I cannot do things like [HITS ?] between tools searching on different fields and in any case its tricky to get the entries to highlight though getting a single domain is easy enough.

 

So I did this by doing the search in L & N and saving the pane contents as a text file in UTF-16. Then processed it with Python to extract the entries and construct a search string which I could paste into BDAG. Laborious ? Well the first time, but perhaps I'll do more of it.

 

If anyone has a better way to do this sort of thing I would love hear about it. Below is the code if anyone wants it.

 

This is the workspace:

 

post-32023-0-08774000-1415940373_thumb.jpg

 

Here is the Python:

 

#!/usr/bin/python
# coding: utf-8
"""
Extract the Greek words from the semantic domain list saved from Accordance
Louw & Nida Greek-English Lexicon of the New Testament Based on Semantic Domains
and construct a query for use in a Tool tab to find hits for all the words.

Requires Python 2.7

Usage:

extractDomainWords.py <TXT file saved from Accordance>

Prerequisites:

You have a text file which is a TXT file save from a search tab on the L & N
lexicon above.

After you run this cut and paste the search string into a search tab. Bear in
mind that you may have to correct some word forms to match what the tool has.
"""

# Copyright Daniel Semler Jan 2014

import codecs, re, sys

def process_args():
"""Return a dictionary with the cmdline arguments
named in a specific way. Keys are :
exe : the name of the executable
filename : the file to process
"""
args = {}
args['exe'] = sys.argv[0]
if len(sys.argv) > 1:
args['filename'] = sys.argv[1]
return args

def find_words(filename):
"""Find all initial words in Greek from each entry. Entries are of the form

27.1 εὑρίσκωb: to learn something previously not known, frequently involving an element of surprise — ‘to learn, to find out, to discover.’ [p. 326] ζητεῖν τὸν θεὸν εἰ ἄρα γε ψηλαφήσειαν αὐτὸν καὶ εὕροιεν ‘to seek God and perhaps find him as they were groping around for him’ Ac 17:27; συνεψήφισαν τὰς τιμὰς αὐτῶν καὶ εὗρον ἀργυρίου μυριάδας πέντε ‘they calculated their value and discovered that they had been worth fifty thousand (drachmas)’ Ac 19:19; οὐχ εὕρισκον τὸ τί ποιήσωσιν ‘but they could not find out how to do it’ Lk 19:48.

It is encoded as UTF-16.

Extract the words up to the first ':' and remove the initial semantic
domain, in this case "27.1 ".
"""
wds = []
for l in codecs.open(filename, encoding = 'utf-16'):
if l is not None:

# Find the words up to the first ':'
sem_word_re = re.compile(u'^\d+.\d+\s+(.*?):.*')
if sem_word_re.search(l) is not None:

# Find the first word up to \s ; ,
w = sem_word_re.search(l).group(1)
trim_word_re = re.compile(u'(.*?)[\s;,].*')
if trim_word_re.search(w) is not None:
sword = trim_word_re.search(w).group(1)
else:
sword = w

# Trim off any trailing a-z footnote indicator
trim_az_re = re.compile(u'(.*?)[a-z]$')
if trim_az_re.search(sword) is not None:
tword = trim_az_re.search(sword).group(1)
else:
tword = sword
wds.append(tword)

return wds

cmd_args = process_args()
if (cmd_args.get('filename') is None):

print __doc__
sys.exit(1)

words = find_words(cmd_args['filename'])

# Construct the query list
print u'(',
num = len(words)
i = 0
for w in words:
print w,
if i < num-1:
print ", ",
i = i + 1
print u')'

 

Thx

D

  • Like 3
Link to comment
Share on other sites

  • 5 years later...

This makes me think it would be great to have a search operator like [FUNC foo args] would call out to foo with args.

 

To avoid the inevitable cross-platform bugs, this could make use of Google Cloud Functions or AWS Lambdas.

Link to comment
Share on other sites

I've actually written an AWS Lambda based query against Hebrew and Greek texts. Of course you need a licensed or open source of data but it can be done.

 

Thx

D

Link to comment
Share on other sites

all the more reason to have built-in support in Accordance.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...