eat-js-sdk 2.3.0 → 2.3.1

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.
@@ -5963,8 +5963,9 @@ const decodeNbsp = (text) => text.replace(/ /g, " ").replace(/ /g,
5963
5963
  const stripTags = (s) => s.replace(/<[^>]+>/g, "");
5964
5964
  const hasHtmlTags = (s) => /<[^>]/.test(s);
5965
5965
  const SUPPORTED_LANGUAGES = /* @__PURE__ */ new Set(["en", "la"]);
5966
+ const LATIN_ACCURACY_THRESHOLD = 0.3;
5966
5967
  const HTML_TOKEN_RE = /(<[^>]+>)/;
5967
- const TEXT_SEGMENT_RE = /(&#39;(?:(?!&#39;).)*&#39;)|(&quot;(?:(?!&quot;).)*&quot;|&#34;(?:(?!&#34;).)*&#34;)|('(?:[^'\\]|\\.)*')|("(?:[^"\\]|\\.)*")|([^'"()[\]{}.?!:&]+[.?!:]?|&(?!quot;|apos;|#34;|#39;)[^;]*;)/g;
5968
+ const TEXT_SEGMENT_RE = /('(?:[^'\\]|\\.)*')|("(?:[^"\\]|\\.)*")|([^'"()[\]{}.?!:&]+[.?!:]?|&[^;]*;)|(.)/g;
5968
5969
  const BRACKET_RE = /(\{[^}]*\}|\([^)]*\)|\[[^\]]*\])/g;
5969
5970
  function extractPlainText(raw) {
5970
5971
  const stripped = raw.replace(/<[^>]+>/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
@@ -5977,7 +5978,7 @@ function isLatin(text) {
5977
5978
  const cached = latinDetectionCache.get(plain);
5978
5979
  if (cached !== void 0) return cached;
5979
5980
  const supported = (a0(plain) ?? []).filter(({ lang }) => SUPPORTED_LANGUAGES.has(lang));
5980
- const result = supported.length > 0 && supported[0].lang === "la";
5981
+ const result = supported.length > 0 && supported[0].lang === "la" && supported[0].accuracy >= LATIN_ACCURACY_THRESHOLD;
5981
5982
  latinDetectionCache.set(plain, result);
5982
5983
  return result;
5983
5984
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "change version": "2.3.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [