This lightweight decoder implements the Sandborg-Petersen morphology schema for Koine Greek — especially New Testament and related texts — in a simple, browser-based tool.
You can try it online at https://tonyjurg.github.io/Sandborg-Petersen-decoder/.
The online version allows also allows for prefilling the decoder with a specific tag by appending ?tag=<TAG>
(for example, ?tag=N-NSF
).
Two functionaly equivalent coding implementations are stored on this repository:
A descriptive document with parsing information is available via github.com/biblicalhumanities.
Because the decoder requires JavaScript to function, it is reasonable to embed a link to it directly in any HTML page using a method depending on JavaScript as well. This approach also lets you open it in a new, resizable window of a specified size.
The first step is to add a script anywhere inside your <HEAD> section, or at the top of your <BODY> section:
<SCRIPT>
function openMinimalWindow() {
window.open(
'https://tonyjurg.github.io/Sandborg-Petersen-decoder/',
'_blank',
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600'
);
}
</SCRIPT>
In the <BODY> section include the following:
<BUTTON onclick="openMinimalWindow()">Open Morph decoder</button>
This will put a button on your page similair to the image below:
If JavaScript is enabled, clicking this button will launch the decoder in a new 800×600 px window without toolbars or menus.
If you prefer a simple hyperlink that opens in a full browser tab, just use:
<A HREF="https://tonyjurg.github.io/Sandborg-Petersen-decoder/" TARGET="_blank">Open Morph decoder</A>
You can also open the decoder pre-filled for a specific tag by appending a tag
query parameter to its URL. In our HTML/JavaScript implementation, a small script reads the URL’s tag
parameter and uses it to initialize the decoder, which is especially handy if you’ve already run your analysis in Python.
import pandas as pd
from IPython.display import HTML
base_url = "https://tonyjurg.github.io/Sandborg-Petersen-decoder/?tag="
# Simple example data
results = [
("Βίβλος", "N-NSF"),
("λόγος", "N-NSM"),
]
# Build dataframe
df = pd.DataFrame(results, columns=["Word", "Tag"])
# Embed clickable HTML links in the 'Tag' column
df["Tag"] = df["Tag"].apply(lambda tag: f'<a href="{base_url}{tag}" target="decoder">{tag}</a>')
# Display as an HTML table with clickable links
HTML(df.to_html(escape=False, index=False))
This will produce the following table:
Word | Tag |
---|---|
Βίβλος | N-NSF |
λόγος | N-NSM |
Note the use of target="decoder"
would normally reuse a single named window. However, in a sanitized environment like Jupyter Notebook, each click opens a new window because Jupyter’s security model isolates browsing contexts. In contrast, when you save the same HTML locally (or serve it as a regular web page), clicks targeting the same window name correctly reuse that single window.
See the following small Jupyter Notebook to see the code in action.