Open mandolyte opened 1 year ago
Below find the USFM and JSON for the English UST for the example reference (1PE 1:1).
The process is roughly as follows:
zaln
tags{
content: "I am Peter",
occurrence: "1"
}
Here is the USFM from 1PE 1:1.
\v 1 {\zaln-s \|x-strong="G40740" x-lemma="πέτρος" x-morph="Gr,N,,,,,NMS," x-occurrence="1" x-occurrences="1" x-content="Πέτρος"\*\w I\|x-occurrence="1" x-occurrences="3"\w*
\w am\|x-occurrence="1" x-occurrences="3"\w*}
\w Peter\|x-occurrence="1" x-occurrences="1"\w*\zaln-e\*,
Here is the corresponding JSON:
{
"1": {
"1": {
"verseObjects": [
{
"type": "text",
"text": "{"
},
{
"tag": "zaln",
"type": "milestone",
"strong": "G40740",
"lemma": "πέτρος",
"morph": "Gr,N,,,,,NMS,",
"occurrence": "1",
"occurrences": "1",
"content": "Πέτρος",
"children": [
{
"text": "I",
"tag": "w",
"type": "word",
"occurrence": "1",
"occurrences": "3"
},
{
"type": "text",
"text": " "
},
{
"text": "am",
"tag": "w",
"type": "word",
"occurrence": "1",
"occurrences": "3"
},
{
"type": "text",
"text": "} "
},
{
"text": "Peter",
"tag": "w",
"type": "word",
"occurrence": "1",
"occurrences": "1"
}
],
"endTag": "zaln-e\\*"
In case it is useful, here is a little node.js script to convert USFM to JSON:
import usfmjs from 'usfm-js';
import { readFile, writeFile } from 'fs';
let testinput = '1pe_usfm.txt';
let jsoninput;
let chapters;
readFile(testinput, (err, data) => {
if (err) throw err;
let s = ""+data;
jsoninput = usfmjs.toJSON(s);
chapters = jsoninput.chapters;
writeFile(testinput+".json",JSON.stringify(chapters, undefined, 4),
function(err) {
if (err) {
return console.log(err);
}
}
);
});
Sketched out the essentials for the quote package (the single word use case only): Where values are mentioned, they come from the TN for 1PE 1:1, id=g6b4. This use case is for a single original word, not phrases or ellipses.
Prerequisites
Notable Conditions
Inputs
Returns
An object with the following properties: