@zodic/shared 0.0.310 → 0.0.311
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/services/ArchetypeService.ts +46 -69
- package/package.json +1 -1
|
@@ -963,77 +963,54 @@ export class ArchetypeService {
|
|
|
963
963
|
return compositions;
|
|
964
964
|
}
|
|
965
965
|
|
|
966
|
-
|
|
967
|
-
english:
|
|
968
|
-
portuguese:
|
|
966
|
+
parseArchetypeNameBlocks(block: string): {
|
|
967
|
+
english: any[];
|
|
968
|
+
portuguese: any[];
|
|
969
969
|
} {
|
|
970
|
-
const
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
.split(
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
const femMatch = entry.match(/• Feminino:\s*([^•]+)/);
|
|
1013
|
-
const essenceMatch = entry.match(/• Essência:\s*([^•]+)/);
|
|
1014
|
-
const masc = mascMatch?.[1]?.trim() ?? '';
|
|
1015
|
-
const fem = femMatch?.[1]?.trim() ?? '';
|
|
1016
|
-
const essenceLine = essenceMatch?.[1]?.trim() ?? '';
|
|
1017
|
-
if (!masc || !fem || !essenceLine) {
|
|
1018
|
-
console.warn(
|
|
1019
|
-
`⚠️ [Parse] Incomplete Portuguese entry ${i + 1}:`,
|
|
1020
|
-
entry
|
|
1021
|
-
);
|
|
1022
|
-
}
|
|
1023
|
-
// Validate gender consistency
|
|
1024
|
-
if (masc.startsWith('A ') && fem.startsWith('O ')) {
|
|
1025
|
-
console.warn(
|
|
1026
|
-
`⚠️ [Parse] Gender mismatch in Portuguese entry ${i + 1}:`,
|
|
1027
|
-
entry
|
|
1028
|
-
);
|
|
1029
|
-
return { masc: fem, fem: masc, essenceLine }; // Swap to correct the mismatch
|
|
1030
|
-
}
|
|
1031
|
-
return { masc, fem, essenceLine };
|
|
1032
|
-
});
|
|
1033
|
-
} catch (error) {
|
|
1034
|
-
console.error('❌ [Parse] Failed to parse block:', error);
|
|
970
|
+
const sections = block.split(/^-EN|^-PT/m).filter((s) => s.trim());
|
|
971
|
+
const english: any[] = [];
|
|
972
|
+
const portuguese: any[] = [];
|
|
973
|
+
|
|
974
|
+
for (const section of sections) {
|
|
975
|
+
if (section.startsWith('EN')) {
|
|
976
|
+
const lines = section.split('\n').filter((l) => l.trim());
|
|
977
|
+
const nameMatch = lines
|
|
978
|
+
.find((l) => l.includes('• Name:'))
|
|
979
|
+
?.split('• Name:')[1]
|
|
980
|
+
?.trim();
|
|
981
|
+
const essenceMatch = lines
|
|
982
|
+
.find((l) => l.includes('• Essence:'))
|
|
983
|
+
?.split('• Essence:')[1]
|
|
984
|
+
?.trim();
|
|
985
|
+
|
|
986
|
+
if (nameMatch && essenceMatch) {
|
|
987
|
+
english.push({ name: nameMatch, essenceLine: essenceMatch });
|
|
988
|
+
}
|
|
989
|
+
} else if (section.startsWith('PT')) {
|
|
990
|
+
const lines = section.split('\n').filter((l) => l.trim());
|
|
991
|
+
const mascMatch = lines
|
|
992
|
+
.find((l) => l.includes('• Masculino:'))
|
|
993
|
+
?.split('• Masculino:')[1]
|
|
994
|
+
?.trim();
|
|
995
|
+
const femMatch = lines
|
|
996
|
+
.find((l) => l.includes('• Feminino:'))
|
|
997
|
+
?.split('• Feminino:')[1]
|
|
998
|
+
?.trim();
|
|
999
|
+
const essenceMatch = lines
|
|
1000
|
+
.find((l) => l.includes('• Essência:'))
|
|
1001
|
+
?.split('• Essência:')[1]
|
|
1002
|
+
?.trim();
|
|
1003
|
+
|
|
1004
|
+
if (mascMatch && femMatch && essenceMatch) {
|
|
1005
|
+
portuguese.push({
|
|
1006
|
+
masc: mascMatch,
|
|
1007
|
+
fem: femMatch,
|
|
1008
|
+
essenceLine: essenceMatch,
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1035
1012
|
}
|
|
1036
1013
|
|
|
1037
|
-
return
|
|
1014
|
+
return { english, portuguese };
|
|
1038
1015
|
}
|
|
1039
1016
|
}
|