@tricoteuses/tisseuse 0.13.12 → 0.14.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.
Files changed (33) hide show
  1. package/dist/{html-DhGw-Yqr.js → html-BKxA21Bq.js} +3118 -2926
  2. package/dist/index.js +64 -64
  3. package/dist/{resolver-DZS-DNp6.js → resolver-dqOM1G7A.js} +191 -137
  4. package/dist/server-f-legi.js +26 -17
  5. package/dist/server.js +1264 -564
  6. package/dist/src/lib/extractors/article_portions.d.ts +8 -0
  7. package/dist/src/lib/extractors/portion_references.d.ts +10 -0
  8. package/dist/src/lib/extractors/portion_references.test.d.ts +1 -0
  9. package/dist/src/lib/extractors/quoted_text.d.ts +20 -0
  10. package/dist/src/lib/extractors/table_of_contents.d.ts +18 -8
  11. package/dist/src/lib/extractors/table_of_contents.test.d.ts +1 -0
  12. package/dist/src/lib/index.d.ts +4 -4
  13. package/dist/src/lib/server/index.d.ts +2 -1
  14. package/dist/src/lib/server/parsed_amendments.d.ts +71 -0
  15. package/dist/src/lib/server/parsed_amendments.test.d.ts +1 -0
  16. package/dist/src/lib/server/parsed_bills.d.ts +6 -3
  17. package/dist/src/lib/text_parsers/action_citation_patterns.d.ts +2 -0
  18. package/dist/src/lib/text_parsers/action_citation_patterns.test.d.ts +1 -0
  19. package/dist/src/lib/text_parsers/action_occurrences.d.ts +3 -0
  20. package/dist/src/lib/text_parsers/action_occurrences.test.d.ts +1 -0
  21. package/dist/src/lib/text_parsers/action_position_cues.d.ts +12 -0
  22. package/dist/src/lib/text_parsers/action_position_cues.test.d.ts +1 -0
  23. package/dist/src/lib/text_parsers/action_target_scopes.d.ts +7 -0
  24. package/dist/src/lib/text_parsers/action_words.d.ts +10 -0
  25. package/dist/src/lib/text_parsers/amendment_action_directives.d.ts +17 -0
  26. package/dist/src/lib/text_parsers/articles.d.ts +17 -0
  27. package/dist/src/lib/text_parsers/citations.d.ts +4 -0
  28. package/dist/src/lib/text_parsers/numbers.d.ts +18 -15
  29. package/dist/src/lib/text_parsers/repeated_actions.d.ts +4 -0
  30. package/dist/src/lib/text_parsers/repeated_actions.test.d.ts +1 -0
  31. package/dist/src/scripts/shared/checkpoint_cli_options.d.ts +4 -0
  32. package/dist/src/scripts/shared/checkpoint_cli_options.test.d.ts +1 -0
  33. package/package.json +1 -1
@@ -65,10 +65,18 @@ export type ArticlePortionMatch = {
65
65
  pathStart: ArticlePortionNode[];
66
66
  pathEnd: ArticlePortionNode[];
67
67
  };
68
+ export type ArticleSubdivisionMarker = {
69
+ index?: number;
70
+ level: number;
71
+ prefix: string;
72
+ restText: string;
73
+ token: string;
74
+ };
68
75
  export declare const ITEM_PREFIX_RE: RegExp;
69
76
  export declare const BARE_ITEM_PREFIX_RE: RegExp;
70
77
  export declare function isRomanNumeral(token: string): boolean;
71
78
  export declare function isArticlePortionStructuralStart(text: string): boolean;
79
+ export declare function parseArticleSubdivisionMarker(text: string): ArticleSubdivisionMarker | undefined;
72
80
  export declare function buildArticlePortionTreeFromHtml(html: string): ArticlePortionArticle;
73
81
  export declare function extractPortionSelectors(reference: TextAstReference): PortionSelector[];
74
82
  export declare function resolvePortionSelector(article: ArticlePortionArticle, selector: PortionSelector): ArticlePortionMatch | null;
@@ -0,0 +1,10 @@
1
+ import { TextAstReference } from '../text_parsers/ast.js';
2
+ export declare function shiftReferencePositions(reference: TextAstReference, offset: number): void;
3
+ export declare function extractPortionReferenceFromPrefix(prefix: string, prefixOffset: number): TextAstReference | null;
4
+ export declare function getReferencePortionSpecificity(reference: TextAstReference): number;
5
+ export declare function getReferencePortionSelectorCount(reference: TextAstReference): number;
6
+ export declare function preferMoreCompletePortionReference(left: TextAstReference | null, right: TextAstReference | null): TextAstReference | null;
7
+ export declare function extractBestPortionReference(references: TextAstReference[]): TextAstReference | null;
8
+ export declare function buildPortionReferenceFromText(text: string, { actionIndex }?: {
9
+ actionIndex?: number;
10
+ }): TextAstReference | null;
@@ -0,0 +1,20 @@
1
+ import { FragmentPosition } from '../text_parsers/fragments.js';
2
+ export type QuotedTextInfo = {
3
+ text: string;
4
+ start: number;
5
+ end: number;
6
+ };
7
+ export type QuoteRange = {
8
+ start: number;
9
+ end: number;
10
+ };
11
+ export declare function normalizeQuotedText(text: string): string;
12
+ export declare function extractQuotedTextInfos(text: string): QuotedTextInfo[];
13
+ export declare function stripQuotedTextSegments(text: string, quotedInfos: Pick<QuotedTextInfo, "start" | "end">[]): string;
14
+ export declare function getQuoteRanges(text: string): QuoteRange[];
15
+ export declare function isInsideRanges(position: FragmentPosition | undefined, ranges: Array<{
16
+ start: number;
17
+ end: number;
18
+ }>): boolean;
19
+ export declare function isInsideQuoteRanges(position: FragmentPosition | undefined, quoteRanges: QuoteRange[]): boolean;
20
+ export declare function replaceQuotedTextWithSpaces(text: string): string;
@@ -3,9 +3,9 @@ import { FragmentPosition, FragmentReverseTransformation } from '../text_parsers
3
3
  import { TextParserContext } from '../text_parsers/parsers.js';
4
4
  import { Transformation } from '../text_parsers/transformers.js';
5
5
  export interface TableOfContents {
6
- articles?: TableOfContentsArticle[];
7
- divisions?: TableOfContentsDivision[];
6
+ items: TableOfContentsItem[];
8
7
  }
8
+ export type TableOfContentsItem = TableOfContentsArticle | TableOfContentsDivision;
9
9
  export interface TableOfContentsArticle {
10
10
  id?: string;
11
11
  line: string;
@@ -16,22 +16,32 @@ export type TableOfContentsArticlePositioned = TableOfContentsArticle & {
16
16
  position: FragmentPosition;
17
17
  };
18
18
  export interface TableOfContentsDivision {
19
- articles?: TableOfContentsArticle[];
20
- divisions?: TableOfContentsDivision[];
21
19
  id?: string;
20
+ items: TableOfContentsItem[];
22
21
  line: string;
23
22
  type: DivisionType;
24
23
  }
25
24
  export type TableOfContentsDivisionPositioned = TableOfContentsDivision & {
26
- articles?: TableOfContentsArticlePositioned[];
27
- divisions?: TableOfContentsDivisionPositioned[];
25
+ items: TableOfContentsItemPositioned[];
28
26
  originalTransformation: FragmentReverseTransformation;
29
27
  position: FragmentPosition;
30
28
  };
29
+ export type TableOfContentsItemPositioned = TableOfContentsArticlePositioned | TableOfContentsDivisionPositioned;
31
30
  export interface TableOfContentsPositioned {
32
- articles?: TableOfContentsArticlePositioned[];
33
- divisions?: TableOfContentsDivisionPositioned[];
31
+ items: TableOfContentsItemPositioned[];
34
32
  }
33
+ /**
34
+ * Return ordered items while remaining compatible with table-of-contents JSON
35
+ * persisted before the `items` representation was introduced.
36
+ *
37
+ * The legacy representation stored articles and divisions separately, so its
38
+ * original interleaving cannot be reconstructed. Keeping its former display
39
+ * order (articles, then divisions) nevertheless lets existing rows remain
40
+ * readable until they are regenerated.
41
+ */
42
+ export declare function getTableOfContentsItems<TItem extends TableOfContentsItem = TableOfContentsItem>(tableOfContents: {
43
+ items: TItem[];
44
+ }): TItem[];
35
45
  export declare function addPositionsToTableOfContentsItems({ context, tableOfContents, transformation, }: {
36
46
  context: TextParserContext;
37
47
  tableOfContents: TableOfContents;
@@ -7,8 +7,8 @@ export { extractBillDefinitions } from './extractors/definitions.js';
7
7
  export { extractActionDirectivesFromHtml, extractActionDirectiveAstsFromText, extractActionDirectivesFromText, resolveActionDirectivesFromHtml, resolveActionDirectivesFromText, type ActionCitation, type ActionDirective, type ActionOperation, type ActionReplacement, type ActionTableTarget, type ResolvedActionDirective, } from './extractors/action_directives.js';
8
8
  export { extractTextLinks, iterReferenceLinks, type ArticleDefinition, type ArticleExternalLink, type ArticleInternalLink, type ArticleLink, type DefinitionOrLink, type DivisionExternalLink, type DivisionLink, type ExtractedLinkDb, type TextEuropeanLink, type TextExternalLink, type TextLink, type TextLinksParserState, } from './extractors/links.js';
9
9
  export { extractCitationReferences, extractReferences, extractReferencesWithOriginalTransformations, getExtractedReferences, getExtractedReferencesWithOriginalTransformations, } from './extractors/references.js';
10
- export { buildArticlePortionTreeFromHtml, extractPortionSelectors, isArticlePortionStructuralStart, resolvePortionSelector, type ArticlePortionArticle, type ArticlePortionDivision, type ArticlePortionItem, type ArticlePortionAlinea, type ArticlePortionPhrase, type ArticlePortionMatch, type ArticlePortionNode, type PortionSelector, type PortionSelectorStep, } from './extractors/article_portions.js';
11
- export { addPositionsToTableOfContentsItems, getExtractedTableOfContentsFromTextBill, walkTableOfContents, type TableOfContents, type TableOfContentsArticle, type TableOfContentsArticlePositioned, type TableOfContentsDivision, type TableOfContentsDivisionPositioned, type TableOfContentsPositioned, } from './extractors/table_of_contents.js';
10
+ export { buildArticlePortionTreeFromHtml, extractPortionSelectors, isArticlePortionStructuralStart, parseArticleSubdivisionMarker, resolvePortionSelector, type ArticlePortionArticle, type ArticlePortionDivision, type ArticlePortionItem, type ArticlePortionAlinea, type ArticlePortionPhrase, type ArticlePortionMatch, type ArticlePortionNode, type ArticleSubdivisionMarker, type PortionSelector, type PortionSelectorStep, } from './extractors/article_portions.js';
11
+ export { addPositionsToTableOfContentsItems, getExtractedTableOfContentsFromTextBill, getTableOfContentsItems, walkTableOfContents, type TableOfContents, type TableOfContentsArticle, type TableOfContentsArticlePositioned, type TableOfContentsDivision, type TableOfContentsDivisionPositioned, type TableOfContentsItem, type TableOfContentsItemPositioned, type TableOfContentsPositioned, } from './extractors/table_of_contents.js';
12
12
  export { jsonReplacer } from './json.js';
13
13
  export { LegiResolver, type LegiArticleInfo, type LegiSectionInfo, type PreloadActiveArticlesByTextIdsOptions, type PreloadTextTitlesInfosOptions, type PreloadTextTitlesInfosProgress, } from './legi/resolver.js';
14
14
  export { buildAndInstallTextTitlesInfos, buildTextTitlesInfos, type BuildTextTitlesInfosProgress, type TextTitlesInfoRow, type TextTitlesInfos, } from './legi/text_titles_infos.js';
@@ -24,9 +24,9 @@ export { getOrLoadDocument, getOrLoadDocumentsByDossierParlementaireUid, getOrLo
24
24
  export { extendLoadedArticle, getOrLoadArticle, getOrLoadJo, getOrLoadSectionTa, getOrLoadSectionsTa, getOrLoadTextelr, getOrLoadTextekali, getOrLoadTexteslr, getOrLoadTextesVersions, getOrLoadTexteVersion, loadArticles, type ArticleExtension, type JorfArticleExtended, type KaliArticleExtended, type LegiArticleExtended, } from './loaders/legifrance.js';
25
25
  export { action } from './text_parsers/actions.js';
26
26
  export { actionDirective } from './text_parsers/action_directives.js';
27
- export { article, articles, definitionArticleDansCitation, definitionArticleDansProjetOuPropositionLoi, designationArticle, listeArticles, nomArticle, nomSpecialArticle, } from './text_parsers/articles.js';
27
+ export { article, articles, definitionArticleDansCitation, definitionArticleDansProjetOuPropositionLoi, designationArticle, extractArticleDefinitionsFromCitation, listeArticles, nomArticle, normalizeBillArticleNumber, parseArticleNumber, parseBillArticleLabel, type ArticleDefinitionInCitation, nomSpecialArticle, type BillArticleLabel, } from './text_parsers/articles.js';
28
28
  export { actionTargets, compoundReferencesSeparators, divisionTypes, europeanLawNatures, frenchLawNatures, internationalLawNatures, isTextAstAtomicReference, isTextAstDivision, isTextAstPortion, lawNatures, localizationAdverbs, portionTypes, type ActionTarget, type CompoundReferencesSeparator, type DivisionType, type EuropeanLawNature, type FrenchLawNature, type InternationalLawNature, type LawNature, type LocalizationAdverb, type PortionType, type TextAst, type TextAstAction, type TextAstActionDirective, type TextAstActionDirectiveOperation, type TextAstActionTargetScope, type TextAstApplicabilityClause, type TextAstArticle, type TextAstAtomicReference, type TextAstBoundedInterval, type TextAstCitation, type TextAstCompoundReference, type TextAstConseilConstitutionnelDecision, type TextAstCountedInterval, type TextAstDivision, type TextAstEnumeration, type TextAstExclusion, type TextAstIncompleteHeader, type TextAstLocalization, type TextAstModificationBlock, type TextAstModificationItem, type TextAstNumber, type TextAstParentChild, type TextAstPortion, type TextAstPosition, type TextAstReference, type TextAstReferenceAndAction, type TextAstText, type TextAstTextIdentification, type TextAstTextInfos, type TextInfosByWordsTree, type TextInfosByWordsTreeNode, } from './text_parsers/ast.js';
29
- export { citation, citationLigne, citationSimple, } from './text_parsers/citations.js';
29
+ export { citation, citationToText, citationLigne, citationSimple, } from './text_parsers/citations.js';
30
30
  export { date, duDate } from './text_parsers/dates.js';
31
31
  export { definitionDivision, designationDivision, division, divisions, natureDivisionSingulier, numeroDivision, } from './text_parsers/divisions.js';
32
32
  export type { FragmentPosition, FragmentReverseTransformation, } from './text_parsers/fragments.js';
@@ -1,11 +1,12 @@
1
1
  export { extractAssembleeAmendmentSearchItems, hashAssembleeAmendmentSearchItem, type AssembleeAmendmentSearchItem, type AssembleeAmendmentSearchItemKind, } from './assemblee_amendment_search.js';
2
2
  export { extractAssembleeExposesDesMotifs, hashAssembleeSearchItem, isoDateFromAssembleeDocument, parseAssembleeDocumentSearchContent, type AssembleeSearchItem, type AssembleeSearchItemKind, type ParsedAssembleeDocumentSearchContent, } from './assemblee_document_search.js';
3
3
  export { extractSenatAmendmentSearchItems, hashSenatAmendmentSearchItem, type SenatAmendmentSearchItem, type SenatAmendmentSearchItemKind, } from './senat_amendment_search.js';
4
+ export { parseAmendment, type ParsedAmendmentDiagnostic, type ParsedAmendmentDirective, type ParsedAmendmentDirectiveKind, type ParsedAmendmentDocument, type ParsedAmendmentFragment, type ParsedAmendmentSourceFormat, type ParsedAmendmentTarget, type ParsedAmendmentTargetPosition, type ParsedAmendmentTargetScope, type ParseAmendmentInput, } from './parsed_amendments.js';
4
5
  export { hashSenatSearchItem, parseSenatDocumentSearchContent, type SenatSearchItem, type SenatSearchItemKind, } from './senat_document_search.js';
5
6
  export { isAkomaNtosoXml, resolveSenatAkomaNtosoSource, type SenatAkomaNtosoSource, } from './senat_document_sources.js';
6
7
  export { simplifyWordHtml, simplifyWordHtmlToDocument, type SimplifyHtmlOptions, } from './html_simplifier.js';
7
8
  export { addLinksOrReferencesToHtmlFile } from './linkers/html.js';
8
- export { linkAkomaNtosoBillRaw, linkAssembleeBillRaw, parseAkomaNtosoBillRaw, parseAssembleeBillRaw, renderAkomaNtosoBillRaw, type LinkedBillDocument, type ParsedBillArticle, type ParsedBillBlock, type ParsedBillBlockKind, type ParsedBillDirective, type ParsedBillDocument, type ParsedBillLink, type ParsedBillSourceFormat, type ParsedBillToc, type ParseBillRawOptions, } from './parsed_bills.js';
9
+ export { linkAkomaNtosoBillRaw, linkAssembleeBillRaw, parseAkomaNtosoBillRaw, parseAssembleeBillRaw, renderAkomaNtosoBillRaw, type LinkedBillDocument, type ParsedBillArticle, type ParsedBillBlock, type ParsedBillBlockKind, type ParsedBillDiagnostic, type ParsedBillDirective, type ParsedBillDocument, type ParsedBillLink, type ParsedBillSourceFormat, type ParsedBillToc, type ParseBillRawOptions, } from './parsed_bills.js';
9
10
  export { type LegiArticleInfo, LegiResolver, type LegiSectionInfo, type PreloadActiveArticlesByTextIdsOptions, type PreloadTextTitlesInfosOptions, type PreloadTextTitlesInfosProgress, } from '../legi/resolver.js';
10
11
  export { buildAndInstallTextTitlesInfos, buildTextTitlesInfos, type BuildTextTitlesInfosProgress, type TextTitlesInfoRow, type TextTitlesInfos, } from '../legi/text_titles_infos.js';
11
12
  export { addPositionsToTableOfContentsFile, simplifiedHtmlBillFileToTableOfContentsFile, } from './tables_of_contents.js';
@@ -0,0 +1,71 @@
1
+ import { TextAstAmendmentActionTargetScope } from '../text_parsers/amendment_action_directives.js';
2
+ import { FragmentPosition, FragmentReverseTransformation } from '../text_parsers/fragments.js';
3
+ import { TextAstReference } from '../text_parsers/ast.js';
4
+ export type ParsedAmendmentSourceFormat = "assemblee-amendement" | "senat-ameli";
5
+ export type ParsedAmendmentTargetPosition = "before_article" | "on_article" | "after_article" | "unknown";
6
+ export type ParsedAmendmentTarget = {
7
+ articleLabel?: string | null;
8
+ targetPosition?: ParsedAmendmentTargetPosition;
9
+ alinea?: number | null;
10
+ alineas?: number[];
11
+ alineaLabel?: string | null;
12
+ subdivisionSourceId?: string | null;
13
+ subdivisionLabel?: string | null;
14
+ subpos?: number | null;
15
+ };
16
+ export type ParsedAmendmentDirectiveKind = "delete_article" | "delete_portion" | "insert_after" | "insert_before" | "insert_article_after" | "insert_article_before" | "replace" | "rewrite_portion";
17
+ export type ParsedAmendmentTargetScope = TextAstAmendmentActionTargetScope;
18
+ export type ParsedAmendmentDirective = {
19
+ kind: ParsedAmendmentDirectiveKind;
20
+ sourceOriginalTransformation?: FragmentReverseTransformation;
21
+ sourcePosition: FragmentPosition;
22
+ sourceText: string;
23
+ target: ParsedAmendmentTarget;
24
+ targetCitation?: ParsedAmendmentFragment;
25
+ targetText?: string;
26
+ targetOccurrence?: "last" | number;
27
+ targetReference?: TextAstReference;
28
+ targetScope?: ParsedAmendmentTargetScope;
29
+ insertCitation?: ParsedAmendmentFragment;
30
+ insertText?: string;
31
+ replacementCitation?: ParsedAmendmentFragment;
32
+ replacementText?: string;
33
+ };
34
+ export type ParsedAmendmentFragment = {
35
+ originalTransformation?: FragmentReverseTransformation;
36
+ position: FragmentPosition;
37
+ text: string;
38
+ };
39
+ export type ParsedAmendmentDiagnostic = {
40
+ code: string;
41
+ message: string;
42
+ sourceOriginalTransformation?: FragmentReverseTransformation;
43
+ sourcePosition?: FragmentPosition;
44
+ sourceText?: string;
45
+ };
46
+ export type ParsedAmendmentDocument = {
47
+ sourceFormat: ParsedAmendmentSourceFormat;
48
+ amendmentId: string;
49
+ amendmentNumber?: string | null;
50
+ dispositifOriginalTransformation?: FragmentReverseTransformation;
51
+ dispositifPosition?: FragmentPosition;
52
+ dispositifText: string | null;
53
+ directives: ParsedAmendmentDirective[];
54
+ diagnostics: ParsedAmendmentDiagnostic[];
55
+ };
56
+ export type ParseAmendmentInput = {
57
+ sourceFormat: ParsedAmendmentSourceFormat;
58
+ amendmentId: string | number;
59
+ amendmentNumber?: string | null;
60
+ sourceKind?: string | null;
61
+ targetArticleLabel?: string | null;
62
+ targetPosition?: ParsedAmendmentTargetPosition | null;
63
+ targetAlinea?: number | null;
64
+ targetAlineaLabel?: string | null;
65
+ targetSubdivisionSourceId?: string | null;
66
+ targetSubdivisionLabel?: string | null;
67
+ targetSubpos?: number | null;
68
+ dispositifHtml?: string | null;
69
+ dispositifText?: string | null;
70
+ };
71
+ export declare function parseAmendment(input: ParseAmendmentInput): ParsedAmendmentDocument;
@@ -0,0 +1 @@
1
+ export {};
@@ -6,6 +6,11 @@ import { LinkType } from '../links.js';
6
6
  export type ParsedBillSourceFormat = "assemblee-html" | "akoma-ntoso";
7
7
  export type ParsedBillBlockKind = "directive_candidate" | "context" | "noise";
8
8
  export type ParsedBillToc = TableOfContents;
9
+ export type ParsedBillDiagnostic = {
10
+ code: string;
11
+ message: string;
12
+ details?: unknown;
13
+ };
9
14
  export type ParsedBillBlock = {
10
15
  id: string;
11
16
  articleId: string;
@@ -41,8 +46,6 @@ export type ParsedBillDirective = {
41
46
  stop: number;
42
47
  };
43
48
  sourceContextBlockIds?: string[];
44
- sourceContextText?: string;
45
- sourceContextHtml?: string;
46
49
  sourceContextPosition?: {
47
50
  start: number;
48
51
  stop: number;
@@ -65,7 +68,6 @@ export type ParsedBillInternalArticleDefinition = ParsedBillInternalArticleTarge
65
68
  blockId?: string;
66
69
  html: string;
67
70
  parentTargetIds?: string[];
68
- sourceDirectiveId?: string;
69
71
  sourceBlockHtml?: string;
70
72
  sourceBlockText?: string;
71
73
  text: string;
@@ -98,6 +100,7 @@ export type ParsedBillDocument = {
98
100
  globalApplicabilityDate?: string;
99
101
  internalArticleDefinitions?: ParsedBillInternalArticleDefinition[];
100
102
  directives: ParsedBillDirective[];
103
+ diagnostics?: ParsedBillDiagnostic[];
101
104
  };
102
105
  export declare function parseAssembleeBillRaw(input: string, options: ParseBillRawOptions): Promise<ParsedBillDocument>;
103
106
  export declare function linkAssembleeBillRaw(input: string, options: ParseBillRawOptions): Promise<LinkedBillDocument>;
@@ -0,0 +1,2 @@
1
+ export declare const citedTargetNamePattern: string;
2
+ export declare const citedReplacementNamePattern: string;
@@ -0,0 +1,3 @@
1
+ export type ActionTargetOccurrence = "last" | number;
2
+ export declare function findOccurrenceIndexBeforePosition(text: string, position: number): number | null;
3
+ export declare function parseActionTargetOccurrenceText(text: string): ActionTargetOccurrence | undefined;
@@ -0,0 +1,12 @@
1
+ import { TextParser } from './parsers.js';
2
+ export type RelativeInsertionCue = "before" | "after";
3
+ export type BoundaryPositionCue = "start" | "end";
4
+ export type ActionPositionCue = RelativeInsertionCue | BoundaryPositionCue;
5
+ export type InsertionOperationKind = "insert_before" | "insert_after";
6
+ export declare const relativeInsertionCuePattern = "(?:avant|apr[e\u00E8]s)";
7
+ export declare const boundaryPositionCuePattern = "(?:(?:au|a[u\u00F9])\\s+d[e\u00E9]but|(?:a|\u00E0)\\s+la\\s+fin)";
8
+ export declare const relativeInsertionCue: TextParser<RelativeInsertionCue>;
9
+ export declare const boundaryPositionCue: TextParser<BoundaryPositionCue>;
10
+ export declare function insertionKindFromRelativeCue(cue: RelativeInsertionCue): InsertionOperationKind;
11
+ export declare function findRelativeInsertionCue(text: string): RelativeInsertionCue | null;
12
+ export declare function findBoundaryPositionCue(text: string): BoundaryPositionCue | null;
@@ -0,0 +1,7 @@
1
+ import { TextAstActionTargetScope, TextAstReference } from './ast.js';
2
+ import { TextParser } from './parsers.js';
3
+ type ActionTargetScopeUnit = NonNullable<TextAstActionTargetScope["unit"]>;
4
+ export declare const actionTargetScope: TextParser;
5
+ export declare function actionTargetScopeUnitFromReference(reference: TextAstReference): ActionTargetScopeUnit | undefined;
6
+ export declare function extractTailAfterTargetScope(text: string): TextAstActionTargetScope | null;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare const ACTION_VERB_RE: RegExp;
2
+ export declare function normalizeActionText(text: string): string;
3
+ export declare function hasActionRedactionIntro(normalizedActionScope: string, normalizedText?: string): boolean;
4
+ export declare function hasAfterCue(normalizedActionScope: string): boolean;
5
+ export declare function hasBeforeCue(normalizedActionScope: string): boolean;
6
+ export declare function hasReestablishAction(normalizedActionScope: string): boolean;
7
+ export declare function hasInsertAction(normalizedActionScope: string): boolean;
8
+ export declare function hasReplaceAction(normalizedActionScope: string): boolean;
9
+ export declare function hasDeleteAction(normalizedActionScope: string): boolean;
10
+ export declare function hasCitationIntroducingAction(normalizedActionScope: string): boolean;
@@ -0,0 +1,17 @@
1
+ import { TextAstActionTargetScope, TextAstCitation, TextAstPosition, TextAstReference } from './ast.js';
2
+ import { TextParser } from './parsers.js';
3
+ export type TextAstAmendmentActionDirective = {
4
+ type: "amendment_action_directive";
5
+ contextText: string;
6
+ kind: "delete_article" | "delete_portion" | "insert_after" | "insert_before" | "insert_article_after" | "insert_article_before" | "replace" | "rewrite_portion";
7
+ insertCitation?: TextAstCitation;
8
+ replacementCitation?: TextAstCitation;
9
+ targetCitation?: TextAstCitation;
10
+ targetReference?: TextAstReference;
11
+ targetScope?: TextAstAmendmentActionTargetScope;
12
+ } & TextAstPosition;
13
+ export type TextAstAmendmentActionTargetScope = TextAstActionTargetScope | {
14
+ type: "head_of_target";
15
+ unit?: "phrase" | "alinéa" | "article";
16
+ };
17
+ export declare const amendmentActionDirective: TextParser;
@@ -1,3 +1,19 @@
1
+ export type BillArticleLabel = {
2
+ label: string;
3
+ num?: string;
4
+ title?: string;
5
+ };
6
+ export type ArticleDefinitionInCitation = {
7
+ num: string;
8
+ position: {
9
+ start: number;
10
+ stop: number;
11
+ };
12
+ start: number;
13
+ };
14
+ export declare function normalizeBillArticleNumber(value: string): string;
15
+ export declare function parseArticleNumber(text: string): string | undefined;
16
+ export declare function parseBillArticleLabel(text: string): BillArticleLabel | null;
1
17
  /**
2
18
  * Nom spécifique d’un article, par exemple « liminaire »
3
19
  */
@@ -41,6 +57,7 @@ export declare const nomArticleProjetOuPropositionLoi: import('./parsers.js').Te
41
57
  * Exemple : « Art. L. 322‑66. - blablabla… en début de ligne
42
58
  */
43
59
  export declare const definitionArticleDansCitation: import('./parsers.js').TextParser<import('./ast.js').TextAst>;
60
+ export declare function extractArticleDefinitionsFromCitation(text: string): ArticleDefinitionInCitation[];
44
61
  /**
45
62
  * Déclaration d'un article dans un projet ou une proposition de loi
46
63
  * Exemple : « Article 2 » en début de ligne
@@ -1,7 +1,11 @@
1
1
  import { TextAst, TextAstCitation } from './ast.js';
2
2
  import { TextParserContext } from './parsers.js';
3
3
  import { TransformationLeaf } from './transformers.js';
4
+ type TextAstPositionRange = TextAstCitation["position"];
5
+ export declare function createTextAstCitation(contentPosition: TextAstPositionRange, position?: TextAstPositionRange): TextAstCitation;
4
6
  export declare const citationLigne: import('./parsers.js').TextParser<TextAst>;
5
7
  export declare const citationSimple: import('./parsers.js').TextParser<TextAst>;
6
8
  export declare const citation: import('./parsers.js').TextParser<TextAst>;
7
9
  export declare function convertCitationToText(context: TextParserContext, citation: TextAstCitation): TransformationLeaf;
10
+ export declare function citationToText(sourceText: string, citation: TextAstCitation): string;
11
+ export {};
@@ -1,24 +1,27 @@
1
1
  import { TextAst } from './ast.js';
2
- export declare const eme: import('./parsers.js').TextParser<TextAst>;
2
+ import { TextParser } from './parsers.js';
3
+ export declare const eme: TextParser<TextAst>;
3
4
  /**
4
5
  * Nombre cardinal ou ordinal
5
6
  */
6
- export declare const nombreAsTextAstNumber: import('./parsers.js').TextParser<TextAst>;
7
- export declare const nombreCardinal: import('./parsers.js').TextParser<TextAst>;
8
- export declare const adjectifNumeralOrdinalCourt: import('./parsers.js').TextParser<TextAst>;
9
- export declare const nombreRomainCardinal: import('./parsers.js').TextParser<TextAst>;
10
- export declare const nombreRomainOrdinal: import('./parsers.js').TextParser<TextAst>;
11
- export declare const nombreRomainOu0iAsTextAstNumber: import('./parsers.js').TextParser<TextAst>;
12
- export declare const adjectifNumeralCardinalDix: import('./parsers.js').TextParser<TextAst>;
13
- export declare const adjectifNumeralCardinalDizaine: import('./parsers.js').TextParser<TextAst>;
14
- export declare const adjectifNumeralCardinalUnite: import('./parsers.js').TextParser<TextAst>;
15
- export declare const adjectifNumeralCardinalLong: import('./parsers.js').TextParser<TextAst>;
16
- export declare const adjectifNumeralCardinal: import('./parsers.js').TextParser<TextAst>;
17
- export declare const adjectifNumeralOrdinalLong: import('./parsers.js').TextParser<TextAst>;
18
- export declare const adjectifNumeralOrdinal: import('./parsers.js').TextParser<TextAst>;
7
+ export declare const nombreAsTextAstNumber: TextParser<TextAst>;
8
+ export declare const nombreCardinal: TextParser<TextAst>;
9
+ export declare const adjectifNumeralOrdinalCourt: TextParser<TextAst>;
10
+ export declare const nombreRomainCardinal: TextParser<TextAst>;
11
+ export declare const nombreRomainOrdinal: TextParser<TextAst>;
12
+ export declare const nombreRomainOu0iAsTextAstNumber: TextParser<TextAst>;
13
+ export declare const adjectifNumeralCardinalDix: TextParser<TextAst>;
14
+ export declare const adjectifNumeralCardinalDizaine: TextParser<TextAst>;
15
+ export declare const adjectifNumeralCardinalUnite: TextParser<TextAst>;
16
+ export declare const adjectifNumeralCardinalLong: TextParser<TextAst>;
17
+ export declare const adjectifNumeralCardinal: TextParser<TextAst>;
18
+ export declare const adjectifNumeralOrdinalLong: TextParser<TextAst>;
19
+ export declare const adjectifNumeralOrdinal: TextParser<TextAst>;
20
+ export declare const occurrenceIndexTokenPattern = "[0-9]+(?:e|er|ere|\u00E8re)?|[A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF'\u2019.-]+";
21
+ export declare function parseOccurrenceIndexFromToken(token: string): number | null;
19
22
  export declare const multiplicativeLatinSuffixes: Array<{
20
23
  pattern: string;
21
24
  value: number;
22
25
  }>;
23
26
  export declare const multiplicativeLatinSuffixPattern: string;
24
- export declare const adverbeMultiplicatifLatin: import('./parsers.js').TextParser<TextAst>;
27
+ export declare const adverbeMultiplicatifLatin: TextParser<TextAst>;
@@ -0,0 +1,4 @@
1
+ import { TextParser } from './parsers.js';
2
+ export declare const repeatedActionQualifier: TextParser<number>;
3
+ export declare function findRepeatedActionCount(text: string): number | null;
4
+ export declare function stripRepeatedActionQualifiers(text: string): string;
@@ -0,0 +1,4 @@
1
+ export declare function normalizeCheckpointCliOptions<Options extends Record<string, unknown>>(options: Options): Options & {
2
+ checkpointBranch?: string;
3
+ checkpointSize?: number | string;
4
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tricoteuses/tisseuse",
3
3
  "description": "Find links in/to French legislative documents",
4
- "version": "0.13.12",
4
+ "version": "0.14.0",
5
5
  "keywords": [
6
6
  "Assemblée nationale",
7
7
  "France",