@chaffjs/lang-ja 0.11.0 → 0.13.0

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.
package/src/structure.ts CHANGED
@@ -266,6 +266,10 @@ const addressOfReference = (
266
266
  const LEXICONS = loadLexicons();
267
267
  const CITATION = citationVocabulary(LEXICONS);
268
268
  const SECTIONS = sectionVocabulary(LEXICONS);
269
+ const NOT_MAGNITUDE = (LEXICONS["not-magnitude"] ?? []).map((entry) => entry.pattern);
270
+
271
+ /** 辞書が桁の語と助数詞に切る一語(「1.5 万葉の世界」)は数量の続きではないので、行頭の番号は節のまま。 */
272
+ const countedAfterNumber = (number: string, rest: string): boolean => !NOT_MAGNITUDE.some((word) => rest.startsWith(word)) && countedAfter(number, rest);
269
273
 
270
274
  const sectionsOf = (text: string): Mention[] => sectionReferences(text, SECTIONS);
271
275
 
@@ -355,6 +359,6 @@ export const structure: StructurePatterns = {
355
359
  obligations,
356
360
  quantities: quantitiesOutsideSections,
357
361
  dates,
358
- countedAfter,
362
+ countedAfter: countedAfterNumber,
359
363
  number,
360
364
  };