@mdgf11/filesystem-lib 2.2.22 → 2.2.23
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.
|
@@ -7,6 +7,11 @@ export declare function loadDocumentFile(doc: PartialJurisprudenciaDocument, typ
|
|
|
7
7
|
export declare function loadDocumentFile(doc: PartialJurisprudenciaDocument, type: "pdf" | "docx" | "txt"): Buffer;
|
|
8
8
|
export declare function writeContentToDocument(doc: PartialJurisprudenciaDocument, content: ContentType, isSumario: boolean): void;
|
|
9
9
|
export declare const ANONIMIZADO_NAME = "Anonimizado";
|
|
10
|
+
/**
|
|
11
|
+
* Saves the anonymized entities JSON as Anonimizado.json in the document's filesystem directory.
|
|
12
|
+
* This file is separate from the NLP Entities.json and records the final entities after anonymization.
|
|
13
|
+
*/
|
|
14
|
+
export declare function saveAnonimizedEntities(doc: PartialJurisprudenciaDocument, entities: Record<string, string[]>): void;
|
|
10
15
|
/**
|
|
11
16
|
* Converts the anonymized HTML text (and optionally summary) to DOCX and PDF files
|
|
12
17
|
* saved as Anonimizado.docx / Anonimizado.pdf in the document's filesystem directory.
|
|
@@ -76,6 +76,16 @@ export function writeContentToDocument(doc, content, isSumario) {
|
|
|
76
76
|
fs.writeFileSync(`${dirPath}/${name}.${content.extension}`, content.data);
|
|
77
77
|
}
|
|
78
78
|
export const ANONIMIZADO_NAME = "Anonimizado";
|
|
79
|
+
/**
|
|
80
|
+
* Saves the anonymized entities JSON as Anonimizado.json in the document's filesystem directory.
|
|
81
|
+
* This file is separate from the NLP Entities.json and records the final entities after anonymization.
|
|
82
|
+
*/
|
|
83
|
+
export function saveAnonimizedEntities(doc, entities) {
|
|
84
|
+
const dirPath = `${ROOT_PATH}${FILESYSTEM_PATH}${generateFilePath(doc)}`;
|
|
85
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
86
|
+
const jsonPath = path.join(dirPath, `${ANONIMIZADO_NAME}.json`);
|
|
87
|
+
fs.writeFileSync(jsonPath, JSON.stringify(entities, null, 2), { encoding: "utf-8" });
|
|
88
|
+
}
|
|
79
89
|
/**
|
|
80
90
|
* Converts the anonymized HTML text (and optionally summary) to DOCX and PDF files
|
|
81
91
|
* saved as Anonimizado.docx / Anonimizado.pdf in the document's filesystem directory.
|
package/package.json
CHANGED
|
@@ -96,6 +96,20 @@ export function writeContentToDocument(
|
|
|
96
96
|
|
|
97
97
|
export const ANONIMIZADO_NAME = "Anonimizado";
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Saves the anonymized entities JSON as Anonimizado.json in the document's filesystem directory.
|
|
101
|
+
* This file is separate from the NLP Entities.json and records the final entities after anonymization.
|
|
102
|
+
*/
|
|
103
|
+
export function saveAnonimizedEntities(
|
|
104
|
+
doc: PartialJurisprudenciaDocument,
|
|
105
|
+
entities: Record<string, string[]>
|
|
106
|
+
): void {
|
|
107
|
+
const dirPath = `${ROOT_PATH}${FILESYSTEM_PATH}${generateFilePath(doc)}`;
|
|
108
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
109
|
+
const jsonPath = path.join(dirPath, `${ANONIMIZADO_NAME}.json`);
|
|
110
|
+
fs.writeFileSync(jsonPath, JSON.stringify(entities, null, 2), { encoding: "utf-8" });
|
|
111
|
+
}
|
|
112
|
+
|
|
99
113
|
/**
|
|
100
114
|
* Converts the anonymized HTML text (and optionally summary) to DOCX and PDF files
|
|
101
115
|
* saved as Anonimizado.docx / Anonimizado.pdf in the document's filesystem directory.
|