@stevenvo780/autologic 1.0.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 (124) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -0
  3. package/dist/atoms/coreference.d.ts +29 -0
  4. package/dist/atoms/coreference.d.ts.map +1 -0
  5. package/dist/atoms/coreference.js +75 -0
  6. package/dist/atoms/coreference.js.map +1 -0
  7. package/dist/atoms/identifier-gen.d.ts +23 -0
  8. package/dist/atoms/identifier-gen.d.ts.map +1 -0
  9. package/dist/atoms/identifier-gen.js +83 -0
  10. package/dist/atoms/identifier-gen.js.map +1 -0
  11. package/dist/atoms/index.d.ts +20 -0
  12. package/dist/atoms/index.d.ts.map +1 -0
  13. package/dist/atoms/index.js +112 -0
  14. package/dist/atoms/index.js.map +1 -0
  15. package/dist/atoms/keyword-extractor.d.ts +29 -0
  16. package/dist/atoms/keyword-extractor.d.ts.map +1 -0
  17. package/dist/atoms/keyword-extractor.js +73 -0
  18. package/dist/atoms/keyword-extractor.js.map +1 -0
  19. package/dist/autologic.d.ts +63 -0
  20. package/dist/autologic.d.ts.map +1 -0
  21. package/dist/autologic.js +107 -0
  22. package/dist/autologic.js.map +1 -0
  23. package/dist/discourse/index.d.ts +18 -0
  24. package/dist/discourse/index.d.ts.map +1 -0
  25. package/dist/discourse/index.js +43 -0
  26. package/dist/discourse/index.js.map +1 -0
  27. package/dist/discourse/markers-en.d.ts +7 -0
  28. package/dist/discourse/markers-en.d.ts.map +1 -0
  29. package/dist/discourse/markers-en.js +113 -0
  30. package/dist/discourse/markers-en.js.map +1 -0
  31. package/dist/discourse/markers-es.d.ts +7 -0
  32. package/dist/discourse/markers-es.d.ts.map +1 -0
  33. package/dist/discourse/markers-es.js +134 -0
  34. package/dist/discourse/markers-es.js.map +1 -0
  35. package/dist/discourse/pattern-detector.d.ts +16 -0
  36. package/dist/discourse/pattern-detector.d.ts.map +1 -0
  37. package/dist/discourse/pattern-detector.js +95 -0
  38. package/dist/discourse/pattern-detector.js.map +1 -0
  39. package/dist/discourse/role-classifier.d.ts +12 -0
  40. package/dist/discourse/role-classifier.d.ts.map +1 -0
  41. package/dist/discourse/role-classifier.js +141 -0
  42. package/dist/discourse/role-classifier.js.map +1 -0
  43. package/dist/formalize.d.ts +25 -0
  44. package/dist/formalize.d.ts.map +1 -0
  45. package/dist/formalize.js +123 -0
  46. package/dist/formalize.js.map +1 -0
  47. package/dist/formula/connectors.d.ts +31 -0
  48. package/dist/formula/connectors.d.ts.map +1 -0
  49. package/dist/formula/connectors.js +90 -0
  50. package/dist/formula/connectors.js.map +1 -0
  51. package/dist/formula/first-order.d.ts +11 -0
  52. package/dist/formula/first-order.d.ts.map +1 -0
  53. package/dist/formula/first-order.js +156 -0
  54. package/dist/formula/first-order.js.map +1 -0
  55. package/dist/formula/index.d.ts +15 -0
  56. package/dist/formula/index.d.ts.map +1 -0
  57. package/dist/formula/index.js +49 -0
  58. package/dist/formula/index.js.map +1 -0
  59. package/dist/formula/modal.d.ts +11 -0
  60. package/dist/formula/modal.d.ts.map +1 -0
  61. package/dist/formula/modal.js +138 -0
  62. package/dist/formula/modal.js.map +1 -0
  63. package/dist/formula/propositional.d.ts +11 -0
  64. package/dist/formula/propositional.d.ts.map +1 -0
  65. package/dist/formula/propositional.js +241 -0
  66. package/dist/formula/propositional.js.map +1 -0
  67. package/dist/formula/temporal.d.ts +11 -0
  68. package/dist/formula/temporal.d.ts.map +1 -0
  69. package/dist/formula/temporal.js +134 -0
  70. package/dist/formula/temporal.js.map +1 -0
  71. package/dist/generator/index.d.ts +6 -0
  72. package/dist/generator/index.d.ts.map +1 -0
  73. package/dist/generator/index.js +12 -0
  74. package/dist/generator/index.js.map +1 -0
  75. package/dist/generator/st-emitter.d.ts +23 -0
  76. package/dist/generator/st-emitter.d.ts.map +1 -0
  77. package/dist/generator/st-emitter.js +134 -0
  78. package/dist/generator/st-emitter.js.map +1 -0
  79. package/dist/generator/validator.d.ts +22 -0
  80. package/dist/generator/validator.d.ts.map +1 -0
  81. package/dist/generator/validator.js +53 -0
  82. package/dist/generator/validator.js.map +1 -0
  83. package/dist/index.d.ts +32 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +44 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/nlp/index.d.ts +8 -0
  88. package/dist/nlp/index.d.ts.map +1 -0
  89. package/dist/nlp/index.js +17 -0
  90. package/dist/nlp/index.js.map +1 -0
  91. package/dist/nlp/stemmer-en.d.ts +10 -0
  92. package/dist/nlp/stemmer-en.d.ts.map +1 -0
  93. package/dist/nlp/stemmer-en.js +149 -0
  94. package/dist/nlp/stemmer-en.js.map +1 -0
  95. package/dist/nlp/stemmer-es.d.ts +10 -0
  96. package/dist/nlp/stemmer-es.d.ts.map +1 -0
  97. package/dist/nlp/stemmer-es.js +117 -0
  98. package/dist/nlp/stemmer-es.js.map +1 -0
  99. package/dist/nlp/stopwords.d.ts +11 -0
  100. package/dist/nlp/stopwords.d.ts.map +1 -0
  101. package/dist/nlp/stopwords.js +73 -0
  102. package/dist/nlp/stopwords.js.map +1 -0
  103. package/dist/nlp/tokenizer.d.ts +13 -0
  104. package/dist/nlp/tokenizer.d.ts.map +1 -0
  105. package/dist/nlp/tokenizer.js +36 -0
  106. package/dist/nlp/tokenizer.js.map +1 -0
  107. package/dist/segmenter/clause-splitter.d.ts +15 -0
  108. package/dist/segmenter/clause-splitter.d.ts.map +1 -0
  109. package/dist/segmenter/clause-splitter.js +192 -0
  110. package/dist/segmenter/clause-splitter.js.map +1 -0
  111. package/dist/segmenter/index.d.ts +11 -0
  112. package/dist/segmenter/index.d.ts.map +1 -0
  113. package/dist/segmenter/index.js +25 -0
  114. package/dist/segmenter/index.js.map +1 -0
  115. package/dist/segmenter/sentence-splitter.d.ts +13 -0
  116. package/dist/segmenter/sentence-splitter.d.ts.map +1 -0
  117. package/dist/segmenter/sentence-splitter.js +69 -0
  118. package/dist/segmenter/sentence-splitter.js.map +1 -0
  119. package/dist/types.d.ts +184 -0
  120. package/dist/types.d.ts.map +1 -0
  121. package/dist/types.js +6 -0
  122. package/dist/types.js.map +1 -0
  123. package/package.json +51 -0
  124. package/readme.md +1 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tokenize = tokenize;
4
+ exports.contentWords = contentWords;
5
+ const stopwords_1 = require("./stopwords");
6
+ const stemmer_es_1 = require("./stemmer-es");
7
+ const stemmer_en_1 = require("./stemmer-en");
8
+ /**
9
+ * Tokeniza un texto en tokens con metadatos.
10
+ */
11
+ function tokenize(text, language = 'es') {
12
+ const stemFn = language === 'es' ? stemmer_es_1.stemEs : stemmer_en_1.stemEn;
13
+ const words = text.match(/[\p{L}\p{N}]+/gu) || [];
14
+ const tokens = [];
15
+ let searchPos = 0;
16
+ for (const word of words) {
17
+ const pos = text.indexOf(word, searchPos);
18
+ const normalized = word.toLowerCase();
19
+ tokens.push({
20
+ text: word,
21
+ normalized,
22
+ stem: stemFn(normalized),
23
+ isStopword: (0, stopwords_1.isStopword)(normalized, language),
24
+ position: pos,
25
+ });
26
+ searchPos = pos + word.length;
27
+ }
28
+ return tokens;
29
+ }
30
+ /**
31
+ * Extrae palabras de contenido (no stopwords) de un texto.
32
+ */
33
+ function contentWords(text, language = 'es') {
34
+ return tokenize(text, language).filter(t => !t.isStopword);
35
+ }
36
+ //# sourceMappingURL=tokenizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../../src/nlp/tokenizer.ts"],"names":[],"mappings":";;AAWA,4BAoBC;AAKD,oCAEC;AAlCD,2CAAyC;AACzC,6CAAsC;AACtC,6CAAsC;AAEtC;;GAEG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,WAAqB,IAAI;IAC9D,MAAM,MAAM,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,mBAAM,CAAC,CAAC,CAAC,mBAAM,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAClD,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,IAAI;YACV,UAAU;YACV,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC;YACxB,UAAU,EAAE,IAAA,sBAAU,EAAC,UAAU,EAAE,QAAQ,CAAC;YAC5C,QAAQ,EAAE,GAAG;SACd,CAAC,CAAC;QACH,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,WAAqB,IAAI;IAClE,OAAO,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Clause Splitter — Divide oraciones en cláusulas usando marcadores discursivos.
3
+ *
4
+ * Estrategia:
5
+ * 1. Detectar marcadores discursivos dentro de la oración
6
+ * 2. Dividir por marcadores (priorizando los más largos)
7
+ * 3. Dividir por comas que separan cláusulas sustantivas
8
+ * 4. Asignar marcadores detectados a cada cláusula
9
+ */
10
+ import type { Clause, Language } from '../types';
11
+ /**
12
+ * Divide una oración en cláusulas basándose en marcadores discursivos.
13
+ */
14
+ export declare function splitClauses(sentence: string, language?: Language): Clause[];
15
+ //# sourceMappingURL=clause-splitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clause-splitter.d.ts","sourceRoot":"","sources":["../../src/segmenter/clause-splitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAkB,QAAQ,EAAc,MAAM,UAAU,CAAC;AAW7E;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAe,GAAG,MAAM,EAAE,CAalF"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitClauses = splitClauses;
4
+ const markers_es_1 = require("../discourse/markers-es");
5
+ const markers_en_1 = require("../discourse/markers-en");
6
+ /**
7
+ * Divide una oración en cláusulas basándose en marcadores discursivos.
8
+ */
9
+ function splitClauses(sentence, language = 'es') {
10
+ const markers = language === 'es' ? markers_es_1.MARKERS_ES : markers_en_1.MARKERS_EN;
11
+ // 1. Detectar todos los marcadores en la oración
12
+ const matches = findMarkers(sentence, markers);
13
+ if (matches.length === 0) {
14
+ // Sin marcadores: intentar dividir por comas significativas
15
+ return splitByCommas(sentence);
16
+ }
17
+ // 2. Dividir la oración usando las posiciones de los marcadores
18
+ return buildClauses(sentence, matches);
19
+ }
20
+ /**
21
+ * Encuentra todos los marcadores discursivos en un texto.
22
+ * Ordena por longitud descendente para priorizar coincidencias más largas.
23
+ */
24
+ function findMarkers(text, markers) {
25
+ const lower = text.toLowerCase();
26
+ const sorted = [...markers].sort((a, b) => b.text.length - a.text.length);
27
+ const matches = [];
28
+ const coveredRanges = [];
29
+ for (const marker of sorted) {
30
+ let searchFrom = 0;
31
+ while (true) {
32
+ const idx = lower.indexOf(marker.text, searchFrom);
33
+ if (idx === -1)
34
+ break;
35
+ const end = idx + marker.text.length;
36
+ // Verificar que sea una palabra completa (no substring)
37
+ const charBefore = idx > 0 ? lower[idx - 1] : ' ';
38
+ const charAfter = end < lower.length ? lower[end] : ' ';
39
+ const isWordBoundary = !/\p{L}/u.test(charBefore) && !/\p{L}/u.test(charAfter);
40
+ // Verificar que no esté cubierto por un marcador más largo
41
+ const overlaps = coveredRanges.some(([s, e]) => idx >= s && end <= e);
42
+ if (isWordBoundary && !overlaps) {
43
+ matches.push({ marker, startPos: idx, endPos: end });
44
+ coveredRanges.push([idx, end]);
45
+ }
46
+ searchFrom = idx + 1;
47
+ }
48
+ }
49
+ // Ordenar por posición
50
+ matches.sort((a, b) => a.startPos - b.startPos);
51
+ return matches;
52
+ }
53
+ /**
54
+ * Construye cláusulas a partir de los marcadores detectados.
55
+ */
56
+ function buildClauses(sentence, matches) {
57
+ const clauses = [];
58
+ let currentStart = 0;
59
+ let clauseIndex = 0;
60
+ for (const match of matches) {
61
+ // Texto antes del marcador (si hay)
62
+ const textBefore = sentence.slice(currentStart, match.startPos).trim();
63
+ // Calcular el inicio de la cláusula después del marcador
64
+ const afterMarker = match.endPos;
65
+ // Encontrar el fin de esta cláusula (siguiente marcador o fin de oración)
66
+ const nextMatch = matches.find(m => m.startPos > match.startPos);
67
+ const clauseEnd = nextMatch ? nextMatch.startPos : sentence.length;
68
+ const clauseText = sentence.slice(afterMarker, clauseEnd).trim();
69
+ // Si hay texto antes del primer marcador, es una cláusula independiente
70
+ if (textBefore && clauseIndex === 0) {
71
+ clauses.push({
72
+ text: cleanClauseText(textBefore),
73
+ markers: [],
74
+ index: clauseIndex++,
75
+ });
76
+ }
77
+ // La cláusula asociada al marcador
78
+ if (clauseText) {
79
+ const detectedMarker = {
80
+ text: match.marker.text,
81
+ role: match.marker.role,
82
+ position: match.startPos,
83
+ };
84
+ // Si ya hay una cláusula previa sin texto propio, adjuntar el marcador
85
+ clauses.push({
86
+ text: cleanClauseText(clauseText),
87
+ markers: [detectedMarker],
88
+ index: clauseIndex++,
89
+ });
90
+ }
91
+ currentStart = clauseEnd;
92
+ }
93
+ // Texto después del último marcador
94
+ const remaining = sentence.slice(currentStart).trim();
95
+ if (remaining && clauses.length > 0) {
96
+ // Adjuntar al último clause si no se ha procesado
97
+ const lastClause = clauses[clauses.length - 1];
98
+ if (lastClause.text === '') {
99
+ lastClause.text = cleanClauseText(remaining);
100
+ }
101
+ }
102
+ else if (remaining) {
103
+ clauses.push({
104
+ text: cleanClauseText(remaining),
105
+ markers: [],
106
+ index: clauseIndex,
107
+ });
108
+ }
109
+ // Si no se generó nada, devolver la oración completa
110
+ if (clauses.length === 0) {
111
+ return [{
112
+ text: cleanClauseText(sentence),
113
+ markers: matches.map(m => ({
114
+ text: m.marker.text,
115
+ role: m.marker.role,
116
+ position: m.startPos,
117
+ })),
118
+ index: 0,
119
+ }];
120
+ }
121
+ // Post-paso: subdividir cláusulas de condición que contienen comas
122
+ // (e.g. "llueve, la calle se moja" → "llueve" + "la calle se moja")
123
+ return postSplitConditionalClauses(clauses);
124
+ }
125
+ /**
126
+ * Post-procesamiento: si una cláusula con marcador de condición contiene
127
+ * una coma significativa, dividirla en antecedente (condición) y consecuente.
128
+ * Ejemplo: "si" + "llueve, la calle se moja" → "llueve" (condition) + "la calle se moja" (assertion)
129
+ */
130
+ function postSplitConditionalClauses(clauses) {
131
+ const conditionRoles = ['condition', 'premise'];
132
+ const result = [];
133
+ let reindex = 0;
134
+ for (const clause of clauses) {
135
+ const hasCondMarker = clause.markers.some(m => conditionRoles.indexOf(m.role) !== -1);
136
+ const commaIdx = clause.text.indexOf(',');
137
+ // Solo dividir si: tiene marcador de condición, contiene coma,
138
+ // y ambas partes tienen al menos 2 palabras
139
+ if (hasCondMarker && commaIdx > 0) {
140
+ const before = clause.text.slice(0, commaIdx).trim();
141
+ const after = clause.text.slice(commaIdx + 1).trim();
142
+ if (before.split(/\s+/).length >= 1 && after.split(/\s+/).length >= 2) {
143
+ // Antecedente: hereda los marcadores de condición
144
+ result.push({
145
+ text: cleanClauseText(before),
146
+ markers: clause.markers,
147
+ index: reindex++,
148
+ });
149
+ // Consecuente: cláusula nueva sin marcador (será clasificada como assertion/consequent)
150
+ result.push({
151
+ text: cleanClauseText(after),
152
+ markers: [],
153
+ index: reindex++,
154
+ });
155
+ continue;
156
+ }
157
+ }
158
+ clause.index = reindex++;
159
+ result.push(clause);
160
+ }
161
+ return result;
162
+ }
163
+ /**
164
+ * Divide por comas cuando no hay marcadores discursivos.
165
+ */
166
+ function splitByCommas(sentence) {
167
+ // Solo dividir si la coma separa cláusulas sustantivas (al menos 3 palabras a cada lado)
168
+ const parts = sentence.split(',').map(s => s.trim()).filter(s => s.length > 0);
169
+ if (parts.length <= 1 || parts.some(p => p.split(/\s+/).length < 2)) {
170
+ return [{
171
+ text: cleanClauseText(sentence),
172
+ markers: [],
173
+ index: 0,
174
+ }];
175
+ }
176
+ return parts.map((part, index) => ({
177
+ text: cleanClauseText(part),
178
+ markers: [],
179
+ index,
180
+ }));
181
+ }
182
+ /**
183
+ * Limpia el texto de una cláusula.
184
+ */
185
+ function cleanClauseText(text) {
186
+ return text
187
+ .replace(/^[,;:\s]+/, '')
188
+ .replace(/[,;:\s]+$/, '')
189
+ .replace(/\s+/g, ' ')
190
+ .trim();
191
+ }
192
+ //# sourceMappingURL=clause-splitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clause-splitter.js","sourceRoot":"","sources":["../../src/segmenter/clause-splitter.ts"],"names":[],"mappings":";;AAuBA,oCAaC;AA1BD,wDAAqD;AACrD,wDAAqD;AASrD;;GAEG;AACH,SAAgB,YAAY,CAAC,QAAgB,EAAE,WAAqB,IAAI;IACtE,MAAM,OAAO,GAAG,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,uBAAU,CAAC,CAAC,CAAC,uBAAU,CAAC;IAE5D,iDAAiD;IACjD,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,4DAA4D;QAC5D,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,gEAAgE;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AAK,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;QACpE,OAAO,CAAC;gBACN,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,EAAE;gBACX,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACjC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC;QAC3B,OAAO,EAAE,EAAE;QACX,KAAK;KACN,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,IAAI;SACR,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Segmenter — Orquestador de segmentación
3
+ */
4
+ export { splitSentences } from './sentence-splitter';
5
+ export { splitClauses } from './clause-splitter';
6
+ import type { Sentence, Language } from '../types';
7
+ /**
8
+ * Segmenta un texto completo en oraciones con cláusulas.
9
+ */
10
+ export declare function segment(text: string, language?: Language): Sentence[];
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/segmenter/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAe,GAAG,QAAQ,EAAE,CAO3E"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitClauses = exports.splitSentences = void 0;
4
+ exports.segment = segment;
5
+ /**
6
+ * Segmenter — Orquestador de segmentación
7
+ */
8
+ var sentence_splitter_1 = require("./sentence-splitter");
9
+ Object.defineProperty(exports, "splitSentences", { enumerable: true, get: function () { return sentence_splitter_1.splitSentences; } });
10
+ var clause_splitter_1 = require("./clause-splitter");
11
+ Object.defineProperty(exports, "splitClauses", { enumerable: true, get: function () { return clause_splitter_1.splitClauses; } });
12
+ const sentence_splitter_2 = require("./sentence-splitter");
13
+ const clause_splitter_2 = require("./clause-splitter");
14
+ /**
15
+ * Segmenta un texto completo en oraciones con cláusulas.
16
+ */
17
+ function segment(text, language = 'es') {
18
+ const rawSentences = (0, sentence_splitter_2.splitSentences)(text);
19
+ return rawSentences.map((raw, index) => ({
20
+ original: raw,
21
+ index,
22
+ clauses: (0, clause_splitter_2.splitClauses)(raw, language),
23
+ }));
24
+ }
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/segmenter/index.ts"],"names":[],"mappings":";;;AAYA,0BAOC;AAnBD;;GAEG;AACH,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,2DAAqD;AACrD,uDAAiD;AAGjD;;GAEG;AACH,SAAgB,OAAO,CAAC,IAAY,EAAE,WAAqB,IAAI;IAC7D,MAAM,YAAY,GAAG,IAAA,kCAAc,EAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACvC,QAAQ,EAAE,GAAG;QACb,KAAK;QACL,OAAO,EAAE,IAAA,8BAAY,EAAC,GAAG,EAAE,QAAQ,CAAC;KACrC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Sentence Splitter — Divide texto en oraciones por puntuación.
3
+ *
4
+ * Estrategia:
5
+ * 1. Split por . ; ? ! (respetando abreviaturas comunes)
6
+ * 2. Filtrar oraciones vacías
7
+ * 3. Preservar texto entre comillas como unidad
8
+ */
9
+ /**
10
+ * Divide un texto en oraciones respetando abreviaturas y comillas.
11
+ */
12
+ export declare function splitSentences(text: string): string[];
13
+ //# sourceMappingURL=sentence-splitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentence-splitter.d.ts","sourceRoot":"","sources":["../../src/segmenter/sentence-splitter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiDrD"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * Sentence Splitter — Divide texto en oraciones por puntuación.
4
+ *
5
+ * Estrategia:
6
+ * 1. Split por . ; ? ! (respetando abreviaturas comunes)
7
+ * 2. Filtrar oraciones vacías
8
+ * 3. Preservar texto entre comillas como unidad
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.splitSentences = splitSentences;
12
+ /** Abreviaturas comunes que NO deben cortar oraciones */
13
+ const ABBREVIATIONS = new Set([
14
+ 'dr', 'dra', 'sr', 'sra', 'srta', 'prof', 'ing',
15
+ 'lic', 'mr', 'mrs', 'ms', 'etc', 'vs', 'eg', 'ie',
16
+ 'p', 'pp', 'vol', 'ed', 'no', 'núm', 'num', 'tel',
17
+ 'art', 'cap', 'fig', 'pág', 'pag',
18
+ ]);
19
+ /**
20
+ * Divide un texto en oraciones respetando abreviaturas y comillas.
21
+ */
22
+ function splitSentences(text) {
23
+ if (!text || !text.trim())
24
+ return [];
25
+ // Proteger texto entre comillas reemplazándolo temporalmente
26
+ const quotes = [];
27
+ let protected_ = text.replace(/"([^"]+)"/g, (_match, content) => {
28
+ quotes.push(content);
29
+ return `__QUOTE_${quotes.length - 1}__`;
30
+ });
31
+ // Split por puntos, punto y coma, signos de interrogación/exclamación
32
+ const parts = [];
33
+ let current = '';
34
+ for (let i = 0; i < protected_.length; i++) {
35
+ const ch = protected_[i];
36
+ if (ch === '.' || ch === ';' || ch === '?' || ch === '!') {
37
+ // Verificar si es una abreviatura
38
+ if (ch === '.') {
39
+ const wordBefore = current.trim().split(/\s+/).pop()?.toLowerCase() || '';
40
+ if (ABBREVIATIONS.has(wordBefore)) {
41
+ current += ch;
42
+ continue;
43
+ }
44
+ // Verificar si es un decimal (e.g., 3.14)
45
+ if (/\d$/.test(current) && i + 1 < protected_.length && /\d/.test(protected_[i + 1])) {
46
+ current += ch;
47
+ continue;
48
+ }
49
+ }
50
+ current += ch;
51
+ const trimmed = current.trim();
52
+ if (trimmed)
53
+ parts.push(trimmed);
54
+ current = '';
55
+ }
56
+ else {
57
+ current += ch;
58
+ }
59
+ }
60
+ // Agregar el último fragmento si hay
61
+ const lastTrimmed = current.trim();
62
+ if (lastTrimmed)
63
+ parts.push(lastTrimmed);
64
+ // Restaurar comillas
65
+ return parts.map(part => {
66
+ return part.replace(/__QUOTE_(\d+)__/g, (_m, idx) => `"${quotes[parseInt(idx)]}"`);
67
+ }).filter(s => s.length > 0);
68
+ }
69
+ //# sourceMappingURL=sentence-splitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentence-splitter.js","sourceRoot":"","sources":["../../src/segmenter/sentence-splitter.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAaH,wCAiDC;AA5DD,yDAAyD;AACzD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;IAC/C,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,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AAC;oBACd,SAAS;gBACX,CAAC;gBACD,0CAA0C;gBAC1C,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBACrF,OAAO,IAAI,EAAE,CAAC;oBACd,SAAS;gBACX,CAAC;YACH,CAAC;YAED,OAAO,IAAI,EAAE,CAAC;YACd,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;YAC/B,IAAI,OAAO;gBAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjC,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,qCAAqC;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAEzC,qBAAqB;IACrB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,184 @@
1
+ /** Perfiles lógicos soportados por ST */
2
+ export type LogicProfile = 'classical.propositional' | 'classical.first_order' | 'modal.k' | 'deontic.standard' | 'epistemic.s5' | 'intuitionistic.propositional' | 'temporal.ltl' | 'paraconsistent.belnap' | 'aristotelian.syllogistic' | 'probabilistic.basic' | 'arithmetic';
3
+ /** Idiomas soportados */
4
+ export type Language = 'es' | 'en';
5
+ /** Estilo de nombres para átomos */
6
+ export type AtomStyle = 'keywords' | 'letters' | 'numbered';
7
+ export interface FormalizeOptions {
8
+ /** Perfil lógico a utilizar (default: 'classical.propositional') */
9
+ profile?: LogicProfile;
10
+ /** Idioma del texto (default: 'es') */
11
+ language?: Language;
12
+ /** Estilo de nombres para átomos (default: 'keywords') */
13
+ atomStyle?: AtomStyle;
14
+ /** Incluir comentarios en el código ST generado (default: true) */
15
+ includeComments?: boolean;
16
+ /** Validar con st-lang parse() (default: true) */
17
+ validateOutput?: boolean;
18
+ /** Profundidad máxima de subdivisión de cláusulas */
19
+ maxClauseDepth?: number;
20
+ }
21
+ export interface AutologicConfig {
22
+ language?: Language;
23
+ defaultProfile?: LogicProfile;
24
+ defaultAtomStyle?: AtomStyle;
25
+ }
26
+ export interface FormalizationResult {
27
+ /** true si se formalizó sin errores */
28
+ ok: boolean;
29
+ /** Código ST completo y válido */
30
+ stCode: string;
31
+ /** Análisis intermedio completo */
32
+ analysis: DiscourseAnalysis;
33
+ /** atomId → texto original */
34
+ atoms: Map<string, string>;
35
+ /** Fórmulas individuales generadas */
36
+ formulas: FormulaEntry[];
37
+ /** Warnings/errores/sugerencias */
38
+ diagnostics: Diagnostic[];
39
+ /** Resultado de validación con st-lang (si validateOutput=true) */
40
+ stValidation?: {
41
+ ok: boolean;
42
+ errors: string[];
43
+ };
44
+ }
45
+ export interface Sentence {
46
+ /** Texto original de la oración */
47
+ original: string;
48
+ /** Índice de la oración en el texto */
49
+ index: number;
50
+ /** Cláusulas dentro de esta oración */
51
+ clauses: Clause[];
52
+ }
53
+ export interface Clause {
54
+ /** Texto limpio de la cláusula */
55
+ text: string;
56
+ /** Marcadores detectados asociados */
57
+ markers: DetectedMarker[];
58
+ /** Rol asignado por el analizador */
59
+ role?: ClauseRole;
60
+ /** Índice dentro de la oración */
61
+ index: number;
62
+ }
63
+ /** Marcador discursivo detectado en el texto */
64
+ export interface DetectedMarker {
65
+ /** Texto del marcador tal como aparece */
66
+ text: string;
67
+ /** Rol lógico que señala */
68
+ role: MarkerRole;
69
+ /** Posición en la cláusula original */
70
+ position: number;
71
+ }
72
+ export type MarkerRole = 'condition' | 'consequent' | 'conclusion' | 'premise' | 'and' | 'or' | 'adversative' | 'negation' | 'universal' | 'existential' | 'necessity' | 'possibility' | 'biconditional' | 'temporal' | 'temporal_next' | 'temporal_until' | 'temporal_always' | 'temporal_eventually';
73
+ export type ClauseRole = 'premise' | 'conclusion' | 'condition' | 'consequent' | 'conjunction' | 'disjunction' | 'negation' | 'assertion' | 'assumption';
74
+ /** Definición de un marcador discursivo */
75
+ export interface MarkerDefinition {
76
+ /** Texto del marcador (lowercase) */
77
+ text: string;
78
+ /** Rol lógico */
79
+ role: MarkerRole;
80
+ /** Idioma */
81
+ language: Language;
82
+ /** Prioridad (mayor = más específico) */
83
+ priority?: number;
84
+ }
85
+ export interface DiscourseAnalysis {
86
+ /** Oraciones analizadas */
87
+ sentences: AnalyzedSentence[];
88
+ /** Estructura argumental global */
89
+ argumentStructure: ArgumentStructure;
90
+ /** Patrones detectados */
91
+ detectedPatterns: string[];
92
+ }
93
+ export interface AnalyzedSentence {
94
+ /** Oración original */
95
+ original: string;
96
+ /** Cláusulas con roles asignados */
97
+ clauses: AnalyzedClause[];
98
+ /** Tipo de oración */
99
+ type: SentenceType;
100
+ }
101
+ export type SentenceType = 'conditional' | 'biconditional' | 'conjunction' | 'disjunction' | 'assertion' | 'negation' | 'universal' | 'existential' | 'modal' | 'temporal' | 'complex';
102
+ export interface AnalyzedClause {
103
+ /** Texto limpio */
104
+ text: string;
105
+ /** Rol lógico asignado */
106
+ role: ClauseRole;
107
+ /** Marcadores discursivos encontrados */
108
+ markers: DetectedMarker[];
109
+ /** Modificadores (negación, cuantificación, etc.) */
110
+ modifiers: ClauseModifier[];
111
+ }
112
+ export interface ClauseModifier {
113
+ type: 'negation' | 'universal' | 'existential' | 'necessity' | 'possibility' | 'temporal_next' | 'temporal_until' | 'temporal_always' | 'temporal_eventually';
114
+ /** Texto del modificador original */
115
+ text: string;
116
+ }
117
+ export interface ArgumentStructure {
118
+ /** Premisas identificadas */
119
+ premises: number[];
120
+ /** Conclusiones identificadas */
121
+ conclusions: number[];
122
+ /** Condiciones */
123
+ conditions: number[];
124
+ /** Relaciones entre oraciones */
125
+ relations: ArgumentRelation[];
126
+ }
127
+ export interface ArgumentRelation {
128
+ from: number;
129
+ to: number;
130
+ type: 'supports' | 'contradicts' | 'implies' | 'equivalent';
131
+ }
132
+ export interface AtomEntry {
133
+ /** Identificador simbólico (e.g., LLUEVE, P, A1) */
134
+ id: string;
135
+ /** Texto natural original */
136
+ text: string;
137
+ /** Índice de la cláusula de origen */
138
+ sourceClause: number;
139
+ /** Rol de la cláusula */
140
+ role?: ClauseRole;
141
+ /** Para first-order: predicado extraído */
142
+ predicate?: string;
143
+ /** Para first-order: variables/constantes */
144
+ terms?: string[];
145
+ }
146
+ export interface FormulaEntry {
147
+ /** Fórmula en sintaxis ST */
148
+ formula: string;
149
+ /** Tipo de statement ST */
150
+ stType: STStatementType;
151
+ /** Nombre/etiqueta */
152
+ label: string;
153
+ /** Texto fuente */
154
+ sourceText: string;
155
+ /** Índice de oración fuente */
156
+ sourceSentence: number;
157
+ /** Comentario descriptivo */
158
+ comment?: string;
159
+ }
160
+ export type STStatementType = 'axiom' | 'derive' | 'check' | 'prove' | 'interpret' | 'define';
161
+ export type ArgumentPattern = 'modus_ponens' | 'modus_tollens' | 'hypothetical_syllogism' | 'disjunctive_syllogism' | 'constructive_dilemma' | 'reductio_ad_absurdum' | 'conditional_chain' | 'universal_generalization' | 'universal_instantiation' | 'simple_assertion' | 'conjunction_introduction' | 'biconditional_introduction';
162
+ export interface Diagnostic {
163
+ /** Nivel de severidad */
164
+ severity: 'error' | 'warning' | 'info' | 'hint';
165
+ /** Mensaje descriptivo */
166
+ message: string;
167
+ /** Código del diagnóstico */
168
+ code?: string;
169
+ /** Índice de la oración relacionada */
170
+ sentenceIndex?: number;
171
+ }
172
+ export interface Token {
173
+ /** Texto original del token */
174
+ text: string;
175
+ /** Texto normalizado (lowercase, trimmed) */
176
+ normalized: string;
177
+ /** Stem del token */
178
+ stem?: string;
179
+ /** Es stopword */
180
+ isStopword: boolean;
181
+ /** Posición en el texto original */
182
+ position: number;
183
+ }
184
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA,yCAAyC;AACzC,MAAM,MAAM,YAAY,GACpB,yBAAyB,GACzB,uBAAuB,GACvB,SAAS,GACT,kBAAkB,GAClB,cAAc,GACd,8BAA8B,GAC9B,cAAc,GACd,uBAAuB,GACvB,0BAA0B,GAC1B,qBAAqB,GACrB,YAAY,CAAC;AAEjB,yBAAyB;AACzB,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,oCAAoC;AACpC,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAI5D,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,mEAAmE;IACnE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kDAAkD;IAClD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;AAID,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,EAAE,EAAE,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ACf,wBAAwB,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,mBAAmB,GACnB,0BAA0B,GAC1B,yBAAyB,GACzB,kBAAkB,GAClB,0BAA0B,GAC1B,4BAA4B,CAAC;AAIjC,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAChD,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,WAAW,KAAK;IACpB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // ═══════════════════════════════════════════════════════════════
3
+ // Autologic — Tipos principales
4
+ // ═══════════════════════════════════════════════════════════════
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,kEAAkE;AAClE,gCAAgC;AAChC,kEAAkE"}