@tricoteuses/tisseuse 0.1.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 (54) hide show
  1. package/LICENSE.md +22 -0
  2. package/README.md +5 -0
  3. package/dist/index.js +707 -0
  4. package/dist/lib/asserts.d.ts +1 -0
  5. package/dist/lib/index.d.ts +3 -0
  6. package/dist/lib/numbers.d.ts +6 -0
  7. package/dist/lib/server/auditors/config.d.ts +4 -0
  8. package/dist/lib/server/config.d.ts +18 -0
  9. package/dist/lib/server/databases/index.d.ts +10 -0
  10. package/dist/lib/server/text_links.d.ts +46 -0
  11. package/dist/lib/server/text_links.test.d.ts +1 -0
  12. package/dist/lib/server/text_parsers/transformers.d.ts +3 -0
  13. package/dist/lib/strings.d.ts +1 -0
  14. package/dist/lib/text_parsers/actions.d.ts +1 -0
  15. package/dist/lib/text_parsers/actions.test.d.ts +1 -0
  16. package/dist/lib/text_parsers/articles.d.ts +53 -0
  17. package/dist/lib/text_parsers/articles.test.d.ts +1 -0
  18. package/dist/lib/text_parsers/ast.d.ts +136 -0
  19. package/dist/lib/text_parsers/citations.d.ts +7 -0
  20. package/dist/lib/text_parsers/citations.test.d.ts +1 -0
  21. package/dist/lib/text_parsers/dates.d.ts +6 -0
  22. package/dist/lib/text_parsers/dates.test.d.ts +1 -0
  23. package/dist/lib/text_parsers/divisions.d.ts +29 -0
  24. package/dist/lib/text_parsers/divisions.test.d.ts +1 -0
  25. package/dist/lib/text_parsers/helpers.d.ts +10 -0
  26. package/dist/lib/text_parsers/index.d.ts +4 -0
  27. package/dist/lib/text_parsers/index.test.d.ts +1 -0
  28. package/dist/lib/text_parsers/numbers.d.ts +17 -0
  29. package/dist/lib/text_parsers/numbers.test.d.ts +1 -0
  30. package/dist/lib/text_parsers/parsers.d.ts +51 -0
  31. package/dist/lib/text_parsers/parsers.test.d.ts +1 -0
  32. package/dist/lib/text_parsers/portions.d.ts +53 -0
  33. package/dist/lib/text_parsers/portions.test.d.ts +1 -0
  34. package/dist/lib/text_parsers/positions.d.ts +4 -0
  35. package/dist/lib/text_parsers/prepositions.d.ts +6 -0
  36. package/dist/lib/text_parsers/prepositions.test.d.ts +1 -0
  37. package/dist/lib/text_parsers/references.d.ts +13 -0
  38. package/dist/lib/text_parsers/references.test.d.ts +1 -0
  39. package/dist/lib/text_parsers/relative_locations.d.ts +9 -0
  40. package/dist/lib/text_parsers/relative_locations.test.d.ts +1 -0
  41. package/dist/lib/text_parsers/separators.d.ts +7 -0
  42. package/dist/lib/text_parsers/simplifiers.d.ts +13 -0
  43. package/dist/lib/text_parsers/simplifiers.test.d.ts +1 -0
  44. package/dist/lib/text_parsers/texts.d.ts +42 -0
  45. package/dist/lib/text_parsers/texts.test.d.ts +1 -0
  46. package/dist/lib/text_parsers/transformers.d.ts +53 -0
  47. package/dist/lib/text_parsers/typography.d.ts +9 -0
  48. package/dist/lib/text_parsers/typography.test.d.ts +1 -0
  49. package/dist/scripts/add_links_to_html_document.d.ts +1 -0
  50. package/dist/scripts/add_references_to_html_document.d.ts +6 -0
  51. package/dist/scripts/extract_texts_infos.d.ts +1 -0
  52. package/dist/scripts/extract_texts_titles_infos.d.ts +1 -0
  53. package/dist/scripts/html_document_to_text.d.ts +1 -0
  54. package/package.json +69 -0
@@ -0,0 +1,6 @@
1
+ export declare function iterCardinalNumeralFormsFromNumber(num: number): Generator<string, void>;
2
+ export declare function iterLatinMultiplicativeAdverbsFromNumber(num: number): Generator<string, void>;
3
+ export declare function iterOrdinalNumeralFormsFromNumber(num: number): Generator<string, void>;
4
+ export declare function numberFromRomanNumeral(romanNumeral: string): number;
5
+ export declare function ordinalNumeralFromNumber(num: number): string | undefined;
6
+ export declare function romanNumeralFromNumber(num: number): string | undefined;
@@ -0,0 +1,4 @@
1
+ import { Audit } from '@auditors/core';
2
+ export declare function auditConfig(audit: Audit, dataUnknown: unknown): [unknown, unknown];
3
+ export declare function auditDb(audit: Audit, dataUnknown: unknown): [unknown, unknown];
4
+ export declare function validateConfig(data: unknown): [unknown, unknown];
@@ -0,0 +1,18 @@
1
+ export interface Config {
2
+ assembleeDb: {
3
+ host: string;
4
+ port: number;
5
+ database: string;
6
+ user: string;
7
+ password: string;
8
+ };
9
+ legiDb: {
10
+ host: string;
11
+ port: number;
12
+ database: string;
13
+ user: string;
14
+ password: string;
15
+ };
16
+ }
17
+ declare const config: Config;
18
+ export default config;
@@ -0,0 +1,10 @@
1
+ import { default as postgres } from 'postgres';
2
+ export interface Version {
3
+ number: number;
4
+ }
5
+ export declare const assembleeDb: postgres.Sql<{}>;
6
+ export declare const assembleeVersionNumber = 7;
7
+ export declare const legiDb: postgres.Sql<{}>;
8
+ export declare const versionNumber = 16;
9
+ export declare function checkAssembleeDb(): Promise<void>;
10
+ export declare function checkDb(): Promise<void>;
@@ -0,0 +1,46 @@
1
+ import { TextAstArticle, TextAstDivision, TextAstPosition, TextAstText } from '../text_parsers/ast.js';
2
+ import { TextParserContext } from '../text_parsers/parsers.js';
3
+ import { TextPosition } from '../text_parsers/positions.js';
4
+ export type DefinitionOrLink = ArticleDefinition | ArticleLink | DivisionLink | TextLink;
5
+ export interface ArticleDefinition {
6
+ article: TextAstArticle;
7
+ /**
8
+ * Same value as article.position, added for homogeneity
9
+ */
10
+ position: TextPosition;
11
+ textId: string;
12
+ type: "article_definition";
13
+ }
14
+ export interface ArticleExternalLink {
15
+ article: TextAstArticle;
16
+ articleId: string;
17
+ position: TextPosition;
18
+ type: "external_article";
19
+ }
20
+ export interface ArticleInternalLink {
21
+ article: TextAstArticle;
22
+ definition: ArticleDefinition;
23
+ position: TextPosition;
24
+ type: "internal_article";
25
+ }
26
+ export type ArticleLink = ArticleExternalLink | ArticleInternalLink;
27
+ export interface DivisionExternalLink {
28
+ division: TextAstDivision;
29
+ position: TextPosition;
30
+ sectionTaId: string;
31
+ type: "external_division";
32
+ }
33
+ export type DivisionLink = DivisionExternalLink;
34
+ export interface TextExternalLink {
35
+ position: TextPosition;
36
+ text: TextAstText & TextAstPosition;
37
+ type: "external_text";
38
+ }
39
+ export type TextLink = TextExternalLink;
40
+ export declare function iterTextLinks(context: TextParserContext, { date, defaultTextId, logIgnoredReferencesTypes, logPartialReferences, logReferences, }: {
41
+ date: string;
42
+ defaultTextId?: string;
43
+ logIgnoredReferencesTypes?: boolean;
44
+ logPartialReferences?: boolean;
45
+ logReferences?: boolean;
46
+ }): AsyncGenerator<DefinitionOrLink, void>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Transformation } from '../../text_parsers/transformers.js';
2
+ export declare function readTransformation(inputDocument: string, transformationDir: string): Transformation;
3
+ export declare function writeTransformation(transformation: Transformation, transformationDir: string, indexesPath?: string): void;
@@ -0,0 +1 @@
1
+ export declare function escapeHtml<StringOrUndefined extends string | undefined>(s: StringOrUndefined, isAttribute?: boolean): StringOrUndefined;
@@ -0,0 +1 @@
1
+ export declare const action: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Nom spécifique d’un article, par exemple « liminaire »
3
+ */
4
+ export declare const nomSpecialArticle: import('./parsers.js').TextParser;
5
+ /**
6
+ * Type d'un article, issu :
7
+ * - issu d’une loi organique (L.O.),
8
+ * - d’une loi (L.),
9
+ * - d’un décret pris en Conseil d’État (R.),
10
+ * - d’un décret simple (D.),
11
+ * - d’un arrêté (A.) ;
12
+ * Une étoile à la suite mentionne un décret pris en
13
+ * Conseil des ministres, par exemple « L.O. » ou « D*. »
14
+ */
15
+ export declare const typeArticle: import('./parsers.js').TextParser;
16
+ /**
17
+ * Numéro générique d’article, par exemple « L.O 113-1 » ou « L328-1 A bis-0 » ou « préliminaire »
18
+ */
19
+ export declare const nomArticle: import('./parsers.js').TextParser;
20
+ /**
21
+ * Numéro d’article, utilisé lors de sa definition,
22
+ * par exemple « L.O 113-1 » ou « L328-1 A bis-0 » ou « préliminaire »
23
+ * Attention cette règle est plus stricte que nomArticle, car, par exemple,
24
+ * dans la ligne :
25
+ * « Art. 235 ter XB - I. - 1. Il est institué une taxe […]
26
+ * le numéro est 235 ter XB et I. et 1. sont des numéros de portions.
27
+ */
28
+ export declare const nomArticleDefinition: import('./parsers.js').TextParser;
29
+ /**
30
+ * Déclaration d'un article
31
+ * Exemple : « Art. L. 322‑66. - blablabla… en début de ligne
32
+ */
33
+ export declare const definitionArticle: import('./parsers.js').TextParser;
34
+ /**
35
+ * Désignation d’un article, de façon absolue (avec son numero ou nom) ou relative (précédent, suivant, …)
36
+ */
37
+ export declare const designationArticle: import('./parsers.js').TextParser;
38
+ export declare const listeArticles1Internal: import('./parsers.js').TextParser;
39
+ /**
40
+ * Liste d’articles, comprenant au minimum deux articles
41
+ */
42
+ export declare const listeArticles: import('./parsers.js').TextParser;
43
+ export declare const articles2Internal: import('./parsers.js').TextParser;
44
+ export declare const articles1Internal: import('./parsers.js').TextParser;
45
+ /**
46
+ * Règle principale pour la reconnaissance d’une liste d’articles
47
+ */
48
+ export declare const articles: import('./parsers.js').TextParser;
49
+ export declare const article1Internal: import('./parsers.js').TextParser;
50
+ /**
51
+ * Règle principale pour la reconnaissance d’un seul article
52
+ */
53
+ export declare const article: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,136 @@
1
+ import { TextPosition } from './positions.js';
2
+ export type CompoundReferencesSeparator = (typeof compoundReferencesSeparators)[number];
3
+ export type DivisionType = (typeof divisionTypes)[number];
4
+ export type EuropeanLawNature = (typeof europeanLawNatures)[number];
5
+ export type FrenchLawNature = (typeof frenchLawNatures)[number];
6
+ export type InternationalLawNature = (typeof internationalLawNatures)[number];
7
+ export type LawNature = (typeof lawNatures)[number];
8
+ export type LocalizationAdverb = (typeof localizationAdverbs)[number];
9
+ export type PortionType = (typeof portionTypes)[number];
10
+ export type TextAst = boolean | null | number | string | TextAstAction | TextAstArticle | TextAstBoundedInterval | TextAstCitation | TextAstLocalization | TextAstNumber | TextAstPosition | TextAstReference | TextAstText | TextAstTextIdentification | TextAstTextInfos | Array<TextAst>;
11
+ export interface TextAstAction {
12
+ action: "CREATION" | "CREATION_OU_MODIFICATION" | "MODIFICATION" | "SUPPRESSION";
13
+ actionInContent?: boolean;
14
+ }
15
+ export type TextAstArticle = {
16
+ definition?: boolean;
17
+ implicitText?: TextAstText | undefined;
18
+ localizationAdverb?: LocalizationAdverb;
19
+ ofTheSaid?: boolean;
20
+ type: "article";
21
+ } & TextAstLocalization & TextAstPosition;
22
+ export type TextAstAtomicReference = TextAstArticle | TextAstDivision | TextAstIncompleteHeader | TextAstPortion | (TextAstText & TextAstPosition);
23
+ export type TextAstBoundedInterval = {
24
+ first: TextAstReference;
25
+ last: TextAstReference;
26
+ type: "bounded-interval";
27
+ } & TextAstPosition;
28
+ export type TextAstCitation = {
29
+ content: TextAstPosition[];
30
+ type: "citation";
31
+ } & TextAstPosition;
32
+ export type TextAstCompoundReference = TextAstBoundedInterval | TextAstCountedInterval | TextAstEnumeration | TextAstExclusion;
33
+ export type TextAstConseilConstitutionnelDecision = {
34
+ num: string;
35
+ type: "décision du Conseil constitutionnel";
36
+ } & TextAstPosition;
37
+ export type TextAstCountedInterval = {
38
+ count: number;
39
+ first: TextAstReference;
40
+ type: "counted-interval";
41
+ } & TextAstPosition;
42
+ export type TextAstDivision = {
43
+ definition?: boolean;
44
+ ofTheSaid?: boolean;
45
+ type: DivisionType;
46
+ } & TextAstLocalization & TextAstPosition;
47
+ export type TextAstEnumeration = {
48
+ coordinator: "," | "et" | "ou";
49
+ left: TextAstReference;
50
+ right: TextAstReference;
51
+ type: "enumeration";
52
+ } & TextAstPosition;
53
+ export type TextAstExclusion = {
54
+ left: TextAstReference;
55
+ right: TextAstReference;
56
+ type: "exclusion";
57
+ } & TextAstPosition;
58
+ export type TextAstIncompleteHeader = {
59
+ localizationAdverb?: LocalizationAdverb;
60
+ ofTheSaid?: boolean;
61
+ type: "incomplete-header";
62
+ } & TextAstLocalization & TextAstPosition;
63
+ export interface TextAstLocalization {
64
+ index?: number;
65
+ num?: string;
66
+ relative?: number | "+∞";
67
+ }
68
+ export type TextAstNumber = {
69
+ text: string;
70
+ value: number;
71
+ } & TextAstPosition;
72
+ export type TextAstParentChild = {
73
+ child: TextAstReference;
74
+ parent: TextAstAtomicReference;
75
+ type: "parent-enfant";
76
+ } & TextAstPosition;
77
+ export type TextAstPortion = {
78
+ ofTheSaid?: boolean;
79
+ type: PortionType;
80
+ } & TextAstLocalization & TextAstPosition;
81
+ export interface TextAstPosition {
82
+ position: TextPosition;
83
+ }
84
+ export type TextAstReference = TextAstAtomicReference | TextAstCompoundReference | TextAstParentChild | TextAstReferenceAndAction;
85
+ export type TextAstReferenceAndAction = {
86
+ action: TextAstAction;
87
+ reference: TextAstReference;
88
+ type: "reference_et_action";
89
+ } & TextAstPosition;
90
+ export type TextAstText = {
91
+ /**
92
+ * For the texts found in the Légifrance datasets, this is
93
+ * Légifrance CID of the text.
94
+ */
95
+ cid?: string;
96
+ date?: string;
97
+ nature: LawNature;
98
+ legislation?: "international" | "UE";
99
+ ofTheSaid?: boolean;
100
+ /**
101
+ * For the texts found in the Légifrance datasets, the title
102
+ * is the Légifrance one ⇒ it may differ from the title given in
103
+ * input.
104
+ */
105
+ title?: string;
106
+ type: "texte";
107
+ } & TextAstLocalization;
108
+ export interface TextAstTextIdentification {
109
+ date?: string;
110
+ /**
111
+ * For the texts found in the Légifrance datasets, this is
112
+ * Légifrance NUM of the text (for example the number of the law).
113
+ */
114
+ num?: string;
115
+ }
116
+ export interface TextAstTextInfos {
117
+ cid: string | string[];
118
+ }
119
+ export type TextInfosByWordsTree = TextAstTextInfos & {
120
+ [word: string]: TextInfosByWordsTree;
121
+ };
122
+ export declare const compoundReferencesSeparators: readonly [",", "à", "et", "ou", "sauf"];
123
+ export declare const europeanLawNatures: readonly ["DIRECTIVE_EURO", "REGLEMENTEUROPEEN"];
124
+ export declare const frenchLawNatures: readonly ["ARRETE", "CIRCULAIRE", "CODE", "CONSTITUTION", "DECRET", "DECRET_LOI", "LOI", "LOI_CONSTIT", "LOI_ORGANIQUE", "ORDONNANCE"];
125
+ export declare const internationalLawNatures: readonly ["CONVENTION"];
126
+ export declare const divisionTypes: readonly ["partie", "livre", "titre", "sous-titre", "chapitre", "section", "sous-section", "paragraphe", "sous-paragraphe", "sous-sous-paragraphe"];
127
+ export declare const lawNatures: readonly ["DIRECTIVE_EURO", "REGLEMENTEUROPEEN", "ARRETE", "CIRCULAIRE", "CODE", "CONSTITUTION", "DECRET", "DECRET_LOI", "LOI", "LOI_CONSTIT", "LOI_ORGANIQUE", "ORDONNANCE", "CONVENTION"];
128
+ /**
129
+ * Portions are elements of an article.
130
+ * "items" is a generic term for lines preceded with a number.
131
+ */
132
+ export declare const portionTypes: readonly ["item", "alinéa", "phrase"];
133
+ export declare const localizationAdverbs: readonly ["après", "avant", "dessous", "dessus"];
134
+ export declare function isTextAstAtomicReference(reference: TextAstReference): reference is TextAstAtomicReference;
135
+ export declare function isTextAstDivision(reference: TextAstReference): reference is TextAstDivision;
136
+ export declare function isTextAstPortion(reference: TextAstReference): reference is TextAstPortion;
@@ -0,0 +1,7 @@
1
+ import { TextAstCitation } from './ast.js';
2
+ import { TextParserContext } from './parsers.js';
3
+ import { TransformationLeaf } from './transformers.js';
4
+ export declare const citationLigne: import('./parsers.js').TextParser;
5
+ export declare const citationSimple: import('./parsers.js').TextParser;
6
+ export declare const citation: import('./parsers.js').TextParser;
7
+ export declare function convertCitationToText(context: TextParserContext, citation: TextAstCitation): TransformationLeaf;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const annee: import('./parsers.js').TextParser;
2
+ export declare const jour: import('./parsers.js').TextParser;
3
+ export declare const mois: import('./parsers.js').TextParser;
4
+ export declare const date: import('./parsers.js').TextParser;
5
+ export declare const duDate: import('./parsers.js').TextParser;
6
+ export declare const espaceDuDate: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Divisions des textes : Divisions des textes supra-articles
3
+ */
4
+ export declare const natureDivisionSingulier: import('./parsers.js').TextParser;
5
+ export declare const natureDivisionPluriel: import('./parsers.js').TextParser;
6
+ export declare const nomDivision: import('./parsers.js').TextParser;
7
+ export declare const numeroDivision: import('./parsers.js').TextParser;
8
+ /**
9
+ * Déclaration d'un article
10
+ * Exemple : « Art. L. 322‑66. - blablabla… en début de ligne
11
+ */
12
+ export declare const definitionDivision: import('./parsers.js').TextParser;
13
+ export declare const designationDivision: import('./parsers.js').TextParser;
14
+ export declare const division2Internal: import('./parsers.js').TextParser;
15
+ export declare const division1Internal: import('./parsers.js').TextParser;
16
+ /**
17
+ * Règle principale pour la reconnaissance d’une seule division
18
+ */
19
+ export declare const division: import('./parsers.js').TextParser;
20
+ /**
21
+ * Liste de divisions, comprenant au minimum deux divisions
22
+ */
23
+ export declare const listeDivisions: import('./parsers.js').TextParser;
24
+ export declare const divisions2Internal: import('./parsers.js').TextParser;
25
+ export declare const divisions1Internal: import('./parsers.js').TextParser;
26
+ /**
27
+ * Règle principale pour la reconnaissance d’une liste de divisions
28
+ */
29
+ export declare const divisions: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { CompoundReferencesSeparator, TextAstAtomicReference, TextAstParentChild, TextAstReference } from './ast.js';
2
+ import { TextPosition } from './positions.js';
3
+ export declare const addChildLeftToLastChild: (reference: TextAstReference, child: TextAstReference) => TextAstReference;
4
+ export declare const createEnumerationOrBoundedInterval: (reference: TextAstReference, remaining: Array<[CompoundReferencesSeparator, TextAstReference]>, position: TextPosition) => TextAstReference;
5
+ export declare const createEnumerationOrBoundedInterval1: (reference: TextAstReference, remaining: Array<[CompoundReferencesSeparator, TextAstReference]>, position: TextPosition, remainingIndex: number) => TextAstReference;
6
+ export declare const createParentChildTreeFromReferences: (child: TextAstReference, ancestors: TextAstAtomicReference[], position: TextPosition) => TextAstReference;
7
+ export declare function iterAtomicFirstParentReferences<T extends TextAstAtomicReference | TextAstParentChild>(reference: TextAstReference): Generator<T, void>;
8
+ export declare function iterAtomicOrParentChildReferences(reference: TextAstReference): Generator<TextAstAtomicReference | TextAstParentChild, void>;
9
+ export declare function iterAtomicReferences(reference: TextAstReference): Generator<TextAstAtomicReference, void>;
10
+ export declare function iterIncludedReferences(reference: TextAstReference): Generator<TextAstReference, void>;
@@ -0,0 +1,4 @@
1
+ import { TextAstReference } from './ast.js';
2
+ import { TextParserContext } from './parsers.js';
3
+ export declare function iterReferences(context: TextParserContext): Generator<TextAstReference, void>;
4
+ export declare const getReferences: (context: TextParserContext) => TextAstReference[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export declare const eme: import('./parsers.js').TextParser;
2
+ /**
3
+ * Nombre cardinal ou ordinal
4
+ */
5
+ export declare const nombreAsTextAstNumber: import('./parsers.js').TextParser;
6
+ export declare const nombreCardinal: import('./parsers.js').TextParser;
7
+ export declare const adjectifNumeralOrdinalCourt: import('./parsers.js').TextParser;
8
+ export declare const nombreRomainCardinal: import('./parsers.js').TextParser;
9
+ export declare const nombreRomainOrdinal: import('./parsers.js').TextParser;
10
+ export declare const nombreRomainOu0iAsTextAstNumber: import('./parsers.js').TextParser;
11
+ export declare const adjectifNumeralCardinalDix: import('./parsers.js').TextParser;
12
+ export declare const adjectifNumeralCardinalDizaine: import('./parsers.js').TextParser;
13
+ export declare const adjectifNumeralCardinalUnite: import('./parsers.js').TextParser;
14
+ export declare const adjectifNumeralCardinal: import('./parsers.js').TextParser;
15
+ export declare const adjectifNumeralOrdinalLong: import('./parsers.js').TextParser;
16
+ export declare const adjectifNumeralOrdinal: import('./parsers.js').TextParser;
17
+ export declare const adverbeMultiplicatifLatin: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ import { TextAst, TextAstArticle, TextAstText, TextAstTextInfos, TextInfosByWordsTree } from './ast.js';
2
+ import { TextPosition } from './positions.js';
3
+ export type TextInfosConverter = (infos: TextAstTextInfos, context: TextParserContext) => TextAst | undefined;
4
+ export type RegExpConverter = (match: RegExpExecArray, context: TextParserContext) => TextAst | undefined;
5
+ export type TextAstConverter<T extends TextAst> = (ast: T, context: TextParserContext) => TextAst | undefined;
6
+ export type TextParser = (context: TextParserContext) => TextAst | undefined;
7
+ export declare class TextParserContext {
8
+ input: string;
9
+ offset: number;
10
+ currentArticle: TextAstArticle | undefined;
11
+ currentText: TextAstText | undefined;
12
+ length: number;
13
+ usedInputs: TextTree | undefined;
14
+ variables: Record<string, TextAst>;
15
+ constructor(input: string, offset?: number);
16
+ position(): TextPosition;
17
+ remaining(): string;
18
+ text(position?: TextPosition): string;
19
+ textFromResults(results: TextAst[] | undefined): string;
20
+ }
21
+ type TextTree = string | null | Array<TextTree>;
22
+ export declare const alternatives: (...alternatives: Array<TextParser | TextParser[]>) => TextParser;
23
+ export declare const chain: (sequence: Array<TextParser | TextParser[]>, { exportVariables, value, }?: {
24
+ exportVariables?: boolean;
25
+ value?: TextAst | TextAstConverter<TextAst[]>;
26
+ }) => TextParser;
27
+ export declare const convert: (parser: TextParser | TextParser[], { value }: {
28
+ value: TextAst | TextAstConverter<TextAst>;
29
+ }) => TextParser;
30
+ export declare const optional: (parser: TextParser | TextParser[], { default: defaultValue, value, }: {
31
+ default: TextAst | TextParser;
32
+ value?: TextAst | TextAstConverter<TextAst>;
33
+ }) => TextParser;
34
+ export declare const parseText: (input: string, parser: TextParser | TextParser[]) => TextAst | undefined;
35
+ export declare const regExp: (regExpContent: string, { flags, value, }?: {
36
+ flags?: "d" | "di" | "dim" | "dimv" | "div" | "dm" | "dmv" | "dv" | "i" | "im" | "imv" | "iv" | "m" | "mv" | "v" | null;
37
+ value?: TextAst | RegExpConverter;
38
+ }) => TextParser;
39
+ export declare const repeat: (parser: TextParser | TextParser[], { max, min, separator, value, }?: {
40
+ max?: number;
41
+ min?: number;
42
+ separator?: TextParser;
43
+ value?: TextAst | TextAstConverter<TextAst[]>;
44
+ }) => TextParser;
45
+ export declare const variable: (name: string, parser: TextParser | TextParser[], { value }?: {
46
+ value?: TextAst | TextAstConverter<TextAst>;
47
+ }) => TextParser;
48
+ export declare const wordsTree: (tree: TextInfosByWordsTree, { value, }?: {
49
+ value?: TextAst | TextInfosConverter;
50
+ }) => TextParser;
51
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,53 @@
1
+ export declare const naturePortionSingulier: import('./parsers.js').TextParser;
2
+ export declare const naturePortionPluriel: import('./parsers.js').TextParser;
3
+ /**
4
+ * Numéro de portion d'article, par exemple « III » ou « c » ou « 3° »
5
+ *
6
+ * Au sein d'un article, une portion peut contenir des sous-…-portions ou des alinéas
7
+ * NB: s’il s’avère plus utile lors de la réutilisation de mieux séparer et structurer
8
+ * ces différents cas, il faudrait découper cette règle en trois.
9
+ */
10
+ export declare const numeroPortion: import('./parsers.js').TextParser;
11
+ /**
12
+ * Portion désignée soit par un adjectif relatif soit par un ordinal écrit en lettres,
13
+ * par exemple « même alinéa » ou « troisième phrase »
14
+ */
15
+ export declare const unePortion: import('./parsers.js').TextParser;
16
+ export declare const numeroPortionOuUnePortion: import('./parsers.js').TextParser;
17
+ export declare const plusieursPortions: import('./parsers.js').TextParser;
18
+ /**
19
+ * Note: `listeQuelquesPortions`, `listePortion`, `listePortions`
20
+ * et `listeQuelquesPortions` sont quasiment identiques.
21
+ * TODO: Les fusionner ?
22
+ */
23
+ export declare const listePlusieursPortions: import('./parsers.js').TextParser;
24
+ /**
25
+ * TODO: Plus réfléchir aux différentes formulations possibles.
26
+ * Attention à ne pas capturer « [elle] les a [reconnus] »,
27
+ * qui pourrait facilement devenir un faux positif dans la loi 78-17.
28
+ *
29
+ * Note: `listeQuelquesPortions`, `listePortion`, `listePortions`
30
+ * et `listeQuelquesPortions` sont quasiment identiques.
31
+ * TODO: Les fusionner ?
32
+ */
33
+ export declare const listePortion: import('./parsers.js').TextParser;
34
+ /**
35
+ * Note: `listeQuelquesPortions`, `listePortion`, `listePortions`
36
+ * et `listeQuelquesPortions` sont quasiment identiques.
37
+ * TODO: Les fusionner ?
38
+ */
39
+ export declare const listeQuelquesPortions: import('./parsers.js').TextParser;
40
+ /**
41
+ * Note: `listeQuelquesPortions`, `listePortion`, `listePortions`
42
+ * et `listeQuelquesPortions` sont quasiment identiques.
43
+ * TODO: Les fusionner ?
44
+ */
45
+ export declare const listePortions: import('./parsers.js').TextParser;
46
+ export declare const portionsEntreParentheses: import('./parsers.js').TextParser;
47
+ export declare const localisationPortion: import('./parsers.js').TextParser;
48
+ export declare const portion: import('./parsers.js').TextParser;
49
+ export declare const portions: import('./parsers.js').TextParser;
50
+ export declare const auPortion: import('./parsers.js').TextParser;
51
+ export declare const auxPortions: import('./parsers.js').TextParser;
52
+ export declare const portionPrecisePluriel: import('./parsers.js').TextParser;
53
+ export declare const portionPreciseSingulier: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface TextPosition {
2
+ start: number;
3
+ stop: number;
4
+ }
@@ -0,0 +1,6 @@
1
+ export declare const introPluriel: import('./parsers.js').TextParser;
2
+ export declare const introSingulier: import('./parsers.js').TextParser;
3
+ export declare const liaisonPluriel: import('./parsers.js').TextParser;
4
+ export declare const liaisonSingulier: import('./parsers.js').TextParser;
5
+ export declare const ditPluriel: import('./parsers.js').TextParser;
6
+ export declare const ditSingulier: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const uniteBasePluriel: import('./parsers.js').TextParser;
2
+ export declare const uniteBaseSingulier: import('./parsers.js').TextParser;
3
+ export declare const uniteBasePreciseePluriel: import('./parsers.js').TextParser;
4
+ export declare const uniteBasePreciseeSingulier: import('./parsers.js').TextParser;
5
+ export declare const deUniteBasePreciseePluriel: import('./parsers.js').TextParser;
6
+ export declare const deUniteBasePreciseeSingulier: import('./parsers.js').TextParser;
7
+ export declare const deUniteBasePrecisee: import('./parsers.js').TextParser;
8
+ export declare const referencePluriel2Internal: import('./parsers.js').TextParser;
9
+ export declare const referenceSingulier2Internal: import('./parsers.js').TextParser;
10
+ export declare const referencePluriel1Internal: import('./parsers.js').TextParser;
11
+ export declare const referenceSingulier1Internal: import('./parsers.js').TextParser;
12
+ export declare const reference1Internal: import('./parsers.js').TextParser;
13
+ export declare const reference: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const adjectifRelatifPluriel: import('./parsers.js').TextParser;
2
+ export declare const adjectifRelatifSingulier: import('./parsers.js').TextParser;
3
+ export declare const adverbeRelatif: import('./parsers.js').TextParser;
4
+ export declare const espaceAdverbeRelatif: import('./parsers.js').TextParser;
5
+ export declare const espacePrecite: import('./parsers.js').TextParser;
6
+ export declare const relatifPluriel: import('./parsers.js').TextParser;
7
+ export declare const relatifPlurielPrepose: import('./parsers.js').TextParser;
8
+ export declare const relatifSingulier: import('./parsers.js').TextParser;
9
+ export declare const relatifSingulierPrepose: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const separateurEnumeration: import('./parsers.js').TextParser;
2
+ /**
3
+ * Note: exclusion must be tested before enumeration (because of ",") and
4
+ * before plage (because of "à").
5
+ */
6
+ export declare const separateurExclusion: import('./parsers.js').TextParser;
7
+ export declare const separateurPlage: import('./parsers.js').TextParser;
@@ -0,0 +1,13 @@
1
+ import { TransformationLeaf, TransformationNode, TransformerLeaf, TransformerNode } from './transformers.js';
2
+ export declare function convertHtmlElementsToText({ removeAWithHref, }?: {
3
+ removeAWithHref?: boolean;
4
+ }): TransformerLeaf;
5
+ export declare function decodeNamedHtmlEntities(input: string): TransformationLeaf;
6
+ export declare function decodeNumericHtmlEntities(input: string): TransformationLeaf;
7
+ export declare function replacePattern(pattern: RegExp | string, replacement: string): TransformerLeaf;
8
+ export declare function replacePatterns(input: string): TransformationNode;
9
+ export declare function simplifyHtml({ removeAWithHref, }?: {
10
+ removeAWithHref?: boolean;
11
+ }): TransformerNode;
12
+ export declare function simplifyText(input: string): TransformationNode;
13
+ export declare function simplifyUnicodeCharacters(input: string): TransformationLeaf;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Nature d’un texte français, par exemple « code » ou « loi organique »
3
+ *
4
+ * Note: Une majuscule est nécessaire à Constitution pour éviter des faux positifs
5
+ * comme "Les quantités qui contribuent à la constitution d’une capacité d’effacement".
6
+ */
7
+ export declare const natureTexteFrancais: import('./parsers.js').TextParser;
8
+ /**
9
+ * Symbole « n° » + identifiant d’un texte français, par exemple « n° 2001-692 »
10
+ */
11
+ export declare const numeroTexteFrancais: import('./parsers.js').TextParser;
12
+ export declare const numeroEtOuDateTexteFrancais: import('./parsers.js').TextParser;
13
+ export declare const decisionConseilConstitutionnel: import('./parsers.js').TextParser;
14
+ /**
15
+ * Règle principale pour la reconnaissance d’un texte français
16
+ *
17
+ * Note: Une majuscule est nécessaire à Constitution pour éviter des faux positifs
18
+ * comme "Les quantités qui contribuent à la constitution d’une capacité d’effacement".
19
+ */
20
+ export declare const texteFrancais: import('./parsers.js').TextParser;
21
+ /**
22
+ * Identifiant d’un texte européen, par exemple « 2002/22/CE »
23
+ */
24
+ export declare const identifiantTexteEuropeen: import('./parsers.js').TextParser;
25
+ /**
26
+ * Numéro d’un texte européen, par exemple « n° 2002/22/CE » ou « 2002/22/CE »
27
+ */
28
+ export declare const numeroTexteEuropeen: import('./parsers.js').TextParser;
29
+ /**
30
+ * Identification d’un texte européen, c’est-à-dire son numero et/ou sa date (sa nature est traitée ailleurs)
31
+ */
32
+ export declare const identificationTexteEuropeen: import('./parsers.js').TextParser;
33
+ /**
34
+ * Nature d’un texte européen, par exemple « règlement (UE) »
35
+ */
36
+ export declare const natureTexteEuropeen: import('./parsers.js').TextParser;
37
+ /**
38
+ * Règle principale pour la reconnaissance d’un texte européen
39
+ */
40
+ export declare const texteEuropeen: import('./parsers.js').TextParser;
41
+ export declare const texteInternational: import('./parsers.js').TextParser;
42
+ export declare const texte: import('./parsers.js').TextParser;
@@ -0,0 +1 @@
1
+ export {};