Strong's New Testament Dictionary

Strong's definitions are retrieved and processed from morphgnt and openscriptures. Few items are corrected and then data is saved as a CSV file. CSV file is a handy format for Python Pandas data processing library. Pandas will be used as a base interface to the Strong's data.

You need to have a nt-strongs.csv file on your local machine in the same directory as strongs.py main script. If CSV file is not found, warning will be given. In this case you can still pass directory and file name as a csv argument when using load_dataframe function.


In [1]:
import strongs
# reload ensures, that the latest version of strongs module is loaded
# this is useful when developing module, but not necessary on production
#reload(strongs)
# load strongs dictionary from other location, if initial load fails
#strongs.load_dataframe(csv = "strongs/nt-strongs.csv");


Retrieving data from local csv copy...

Find item by lemma

You can get dictionary items by all five fields: lemma, word, transliteration, translation and isopsephy value. This is done by find function on strongs -module. Example given below retrieves Strong's greek definition G99 from dictionary:


In [2]:
lemma = "G99"
# first argument is search item. second is field name
result = strongs.find(lemma, 'lemma')
# print result using Pandas table output
result


Out[2]:
lemma word translation transliteration isopsephy
15 G991 βλεπω to look at (literally or figuratively) blepw 917
868 G999 βοθυνος a hole (in the ground); specially, a cistern boqunos 801
1588 G994 βοαω to halloo, i.e. shout (for help or in a tumult... boaw 873
2362 G993 Βοανεργες sons of commotion; Boanerges, an epithet of tw... Boanerges 436
2449 G996 βοηθεια aid; specially, a rope or chain for frapping a... bohqeia 105
3072 G99 Αδριας the Adriatic sea (including the Ionian) Adrias 316
3183 G995 βοη a halloo, i.e. call (for aid, etc.) boh 80
4046 G990 βλεμμα vision (properly concrete; by implication, abs... blemma 118
4672 G998 βοηθος a succorer bohqos 359
5098 G992 βλητεος fit to be cast (i.e. applied) blhteos 615
5508 G997 βοηθεω to aid or relieve bohqew 894

11 rows × 5 columns

As you can see, result contains all items having a substring "G99". You can get more limited result by passing search query using python regular expression engine.

\$ at the end means searched string must end with given query. Because all lemmas starts with G in Greek Strong's definitions, we don't need to handle beginning part of the search string in this case. But you would do that kind of limit with expression: '^'+lemma+'\$'. Let's get dictionary item with exact lemma:


In [3]:
strongs.find(lemma+'$', 'lemma')


Out[3]:
lemma word translation transliteration isopsephy
3072 G99 Αδριας the Adriatic sea (including the Ionian) Adrias 316

1 rows × 5 columns

Alternatively you can pass compiled regex object to get item(s) even more efficiently. This is useful especially, if you do a lot of search queries with regular expression style.


In [4]:
import re
regex = re.compile('^'+lemma+'$')
result = strongs.find(regex, 'lemma')
result


Out[4]:
lemma word translation transliteration isopsephy
3072 G99 Αδριας the Adriatic sea (including the Ionian) Adrias 316

1 rows × 5 columns

Finally, retrieving certain field content is done either by joining array of result item(s), which works well now, because there is only one search result:


In [5]:
print lemma + ": " + ''.join(result.word)


G99: Αδριας

or by retrieving row by index:


In [6]:
print lemma + ": " + result.translation[3072]


G99: the Adriatic sea (including the Ionian)

Search example queries with other fields

Word

Words stored on the database are simplified greek letters without accents/diacritics. That's why you may need to pre process greek words before making a search by word. To remove unwanted characters and remove accents you can use preprocess_greek function, which is included from isopsephy module to the strongs module. Here we are using "unaccented" word on search:


In [7]:
strongs.find("ψυχρος", 'word')


Out[7]:
lemma word translation transliteration isopsephy
5492 G5593 ψυχρος chilly (literally or figuratively) yuxros 2070

1 rows × 5 columns

And same with pre processing:


In [8]:
word = strongs.preprocess_greek("ψυχρός")
strongs.find(word, 'word')


Out[8]:
lemma word translation transliteration isopsephy
5492 G5593 ψυχρος chilly (literally or figuratively) yuxros 2070

1 rows × 5 columns

Translation


In [9]:
strongs.find("flute", 'translation')


Out[9]:
lemma word translation transliteration isopsephy
1557 G832 αυλεω to play the flute aulew 1236
4620 G836 αυλος a flute (as blown) aulos 701
5512 G834 αυλητης a flute-player aulhths 947

3 rows × 5 columns

Isopsephy

Main reason for making Strong's dictionary to iPython Notebook application is the ongoing isopsephy research. You can read more of the project from GitHub Isopsephy Project repository.

Main idea of the isopsephy is that all 27 letters of Greek alphabet has a numeric value (1-9, 10-90, 100-900). So all words can be calculated to have a sum of the alphabet values. On next example we find out all word on Strong's dictionary having the numerical value of 1008:


In [10]:
strongs.find(321, 'isopsephy')


Out[10]:
lemma word translation transliteration isopsephy
1121 G2570 καλος beautiful, beauteous, fair kalos 321
1603 G3485 ναος a fane, shrine, temple naos 321

2 rows × 5 columns

Search form

Strongs module also provides search results in html format that can be used to interact with strongs database via html form. On next three steps we:

  1. Import search_strongs_dictionary_html function from strongs module
  2. Create html form with input fields and buttons
  3. Attach javascript to handle intercation between notebook and Python

If you download notebook to your local machine or use wakari notebook provider, you can see form in action. Otherwise you will just see static html and example result.


In [11]:
from strongs import search_strongs_dictionary_html, print_search_form_html, print_search_form_js
print_search_form_html()


Out[11]:

Search

Greek
Roman
Lemma
Isopsephy
Translation

Results

LemmaWordTransliterationTranslationIsopsephy
G717ΑρμαγεδδωνArmageddwnArmageddon (or Har-Meggiddon), a symbolic name1008

In [12]:
print_search_form_js()


Out[12]:

The MIT License (MIT)

Copyright (c) 2014 Marko Manninen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.