scripture-guide 1.0.84 → 1.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -208,6 +208,9 @@ const raw_regex_orig = {
208
208
  ["\\s+"," "],
209
209
  ["([a-z]\\s*\\d+)(-\\d+:\\d+)","$1:1$2"],
210
210
  ["--","\u2014"]
211
+ ],
212
+ "joiners": [
213
+ "^[;, &]*(and|c\\.*f\\.*|&|cited\\s+at|see\\s+also|compare|cf|see)*\\s*$"
211
214
  ]
212
215
  };
213
216
  const raw_lang = {
@@ -1021,7 +1024,7 @@ const processReferenceDetection = (content,books,lang_extra,lookupReference,call
1021
1024
  const gapsBetweenIndeces = calculateGaps(matchIndeces);
1022
1025
  const gapStrings = gapsBetweenIndeces.map(([start,end])=>content.substring(start,end).trim());
1023
1026
  //console.log({matches,matchIndeces,gapsBetweenIndeces,gapStrings});
1024
- const joiners = lang_extra.joiners || ["^[;, ]*(and|c\\.*f\\.*)*$"];
1027
+ const joiners = lang_extra.joiners || ["^[;, &]*(and|c\\.*f\\.*|&|cited\\s+at|see\\s+also|compare|cf|see)*\\s*$"];
1025
1028
  const gapThatMayBeMerged = gapsBetweenIndeces.map(([start,end],i)=>{
1026
1029
  const gapString = gapStrings[i];
1027
1030
  const canBeMerged = joiners.some(joiner=>(new RegExp(joiner,"ig")).test(gapString));
@@ -1093,7 +1096,7 @@ const detectReferencesWithContext = (content, books, lang_extra, lookupReference
1093
1096
  // Step 5: Apply the same gap merging logic as original
1094
1097
  const gapsBetweenIndices = calculateGaps(nonOverlappingMatches);
1095
1098
 
1096
- const joiners = lang_extra.joiners || ["^[;]*(and|cf\\.)*$", "^\\s*[;,]\\s*$"]; // More restrictive joiners
1099
+ const joiners = lang_extra.joiners || ["^[;, &]$"];
1097
1100
  const gapThatMayBeMerged = gapsBetweenIndices.map(([start, end]) => {
1098
1101
  const gapString = content.substring(start, end).trim();
1099
1102
  return joiners.some(joiner => (new RegExp(joiner, "ig")).test(gapString));
@@ -1888,6 +1891,7 @@ const getLanguageConfig = function(language) {
1888
1891
 
1889
1892
  // For English or if language not found, use defaults
1890
1893
  if (effectiveLanguage === 'en' || !raw_lang[effectiveLanguage]) {
1894
+ config.lang_extra.joiners = config.raw_regex.joiners;
1891
1895
  return config;
1892
1896
  }
1893
1897
 
@@ -1914,6 +1918,7 @@ const getLanguageConfig = function(language) {
1914
1918
  config.raw_regex.post_rules = langData.post_rules || config.raw_regex.post_rules;
1915
1919
  config.raw_regex.spacing = langData.spacing || ["\\b", ""];
1916
1920
  config.lang_extra = langData.matchRules || {};
1921
+ config.lang_extra.joiners = config.lang_extra.joiners || config.raw_regex.joiners;
1917
1922
  config.wordBreak = langData.wordBreak || "\\b";
1918
1923
 
1919
1924
  return config;
@@ -208,6 +208,9 @@ const raw_regex_orig = {
208
208
  ["\\s+"," "],
209
209
  ["([a-z]\\s*\\d+)(-\\d+:\\d+)","$1:1$2"],
210
210
  ["--","\u2014"]
211
+ ],
212
+ "joiners": [
213
+ "^[;, &]*(and|c\\.*f\\.*|&|cited\\s+at|see\\s+also|compare|cf|see)*\\s*$"
211
214
  ]
212
215
  };
213
216
  const raw_lang = {
@@ -1021,7 +1024,7 @@ const processReferenceDetection = (content,books,lang_extra,lookupReference,call
1021
1024
  const gapsBetweenIndeces = calculateGaps(matchIndeces);
1022
1025
  const gapStrings = gapsBetweenIndeces.map(([start,end])=>content.substring(start,end).trim());
1023
1026
  //console.log({matches,matchIndeces,gapsBetweenIndeces,gapStrings});
1024
- const joiners = lang_extra.joiners || ["^[;, ]*(and|c\\.*f\\.*)*$"];
1027
+ const joiners = lang_extra.joiners || ["^[;, &]*(and|c\\.*f\\.*|&|cited\\s+at|see\\s+also|compare|cf|see)*\\s*$"];
1025
1028
  const gapThatMayBeMerged = gapsBetweenIndeces.map(([start,end],i)=>{
1026
1029
  const gapString = gapStrings[i];
1027
1030
  const canBeMerged = joiners.some(joiner=>(new RegExp(joiner,"ig")).test(gapString));
@@ -1093,7 +1096,7 @@ const detectReferencesWithContext = (content, books, lang_extra, lookupReference
1093
1096
  // Step 5: Apply the same gap merging logic as original
1094
1097
  const gapsBetweenIndices = calculateGaps(nonOverlappingMatches);
1095
1098
 
1096
- const joiners = lang_extra.joiners || ["^[;]*(and|cf\\.)*$", "^\\s*[;,]\\s*$"]; // More restrictive joiners
1099
+ const joiners = lang_extra.joiners || ["^[;, &]$"];
1097
1100
  const gapThatMayBeMerged = gapsBetweenIndices.map(([start, end]) => {
1098
1101
  const gapString = content.substring(start, end).trim();
1099
1102
  return joiners.some(joiner => (new RegExp(joiner, "ig")).test(gapString));
@@ -1888,6 +1891,7 @@ const getLanguageConfig = function(language) {
1888
1891
 
1889
1892
  // For English or if language not found, use defaults
1890
1893
  if (effectiveLanguage === 'en' || !raw_lang[effectiveLanguage]) {
1894
+ config.lang_extra.joiners = config.raw_regex.joiners;
1891
1895
  return config;
1892
1896
  }
1893
1897
 
@@ -1914,6 +1918,7 @@ const getLanguageConfig = function(language) {
1914
1918
  config.raw_regex.post_rules = langData.post_rules || config.raw_regex.post_rules;
1915
1919
  config.raw_regex.spacing = langData.spacing || ["\\b", ""];
1916
1920
  config.lang_extra = langData.matchRules || {};
1921
+ config.lang_extra.joiners = config.lang_extra.joiners || config.raw_regex.joiners;
1917
1922
  config.wordBreak = langData.wordBreak || "\\b";
1918
1923
 
1919
1924
  return config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scripture-guide",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "A utility for biblical and scripture reference parsing that enables structured queries based on strings of traditional scripture references (e.g. John 3:16). ",
5
5
  "main": "dist/scriptures.cjs",
6
6
  "module": "dist/scriptures.mjs",