mirror of
https://github.com/elder-plinius/P4RS3LT0NGV3.git
synced 2026-08-09 04:26:03 +02:00
Add Latin-root lexeme analysis to prompt tools
This commit is contained in:
@@ -24,6 +24,7 @@ class AntiClassifierTool extends Tool {
|
||||
acInput: '',
|
||||
acOutput: '',
|
||||
acError: '',
|
||||
acLexemeAnalysis: { totalFindings: 0, findings: [], summary: 'No Latin-root wording findings.' },
|
||||
acLoading: false,
|
||||
acModel: localStorage.getItem('ac-model') || 'anthropic/claude-sonnet-4.6',
|
||||
acModels: models,
|
||||
@@ -49,6 +50,13 @@ class AntiClassifierTool extends Tool {
|
||||
? window.ANTICLASSIFIER_SYSTEM_PROMPT
|
||||
: '';
|
||||
},
|
||||
acRefreshLexemeAnalysis: function() {
|
||||
if (typeof window === 'undefined' || !window.LexemeAnalysis || typeof window.LexemeAnalysis.analyze !== 'function') {
|
||||
this.acLexemeAnalysis = { totalFindings: 0, findings: [], summary: 'Lexeme analysis unavailable.' };
|
||||
return;
|
||||
}
|
||||
this.acLexemeAnalysis = window.LexemeAnalysis.analyze(this.acInput);
|
||||
},
|
||||
acRun: async function() {
|
||||
const apiKey = this.acGetApiKey();
|
||||
if (!apiKey) {
|
||||
@@ -123,6 +131,39 @@ class AntiClassifierTool extends Tool {
|
||||
if (this.acOutput) {
|
||||
this.copyToClipboard(this.acOutput);
|
||||
}
|
||||
},
|
||||
acGetLexemeAnalysis: function() {
|
||||
return this.acLexemeAnalysis || { totalFindings: 0, findings: [], summary: 'No Latin-root wording findings.' };
|
||||
},
|
||||
acNeutralizeInput: function() {
|
||||
const analysis = this.acGetLexemeAnalysis();
|
||||
if (!analysis.totalFindings || !window.LexemeAnalysis || typeof window.LexemeAnalysis.neutralizeText !== 'function') {
|
||||
return;
|
||||
}
|
||||
this.acInput = window.LexemeAnalysis.neutralizeText(this.acInput, analysis);
|
||||
if (typeof this.showNotification === 'function') {
|
||||
this.showNotification('Applied neutral Latin-root rewrites', 'success', 'fas fa-seedling');
|
||||
}
|
||||
},
|
||||
acApplyLexemeRewrite: function(term, rewrite) {
|
||||
if (!term || !rewrite) {
|
||||
return;
|
||||
}
|
||||
const escapedTerm = String(term).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
this.acInput = this.acInput.replace(new RegExp('\\b' + escapedTerm + '\\b', 'i'), rewrite);
|
||||
if (typeof this.showNotification === 'function') {
|
||||
this.showNotification('Applied rewrite for ' + term, 'success', 'fas fa-pen');
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getVueWatchers() {
|
||||
return {
|
||||
acInput: function() {
|
||||
if (typeof this.acRefreshLexemeAnalysis === 'function') {
|
||||
this.acRefreshLexemeAnalysis();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ class PromptCraftTool extends Tool {
|
||||
pcInput: '',
|
||||
pcOutput: '',
|
||||
pcOutputs: [],
|
||||
pcLexemeAnalysis: { totalFindings: 0, findings: [], summary: 'No Latin-root wording findings.' },
|
||||
pcStrategy: 'rephrase',
|
||||
pcModel: localStorage.getItem('pc-model') || 'nousresearch/hermes-3-llama-3.1-405b',
|
||||
pcTemperature,
|
||||
@@ -78,6 +79,13 @@ class PromptCraftTool extends Tool {
|
||||
}
|
||||
return base;
|
||||
},
|
||||
pcRefreshLexemeAnalysis: function() {
|
||||
if (typeof window === 'undefined' || !window.LexemeAnalysis || typeof window.LexemeAnalysis.analyze !== 'function') {
|
||||
this.pcLexemeAnalysis = { totalFindings: 0, findings: [], summary: 'Lexeme analysis unavailable.' };
|
||||
return;
|
||||
}
|
||||
this.pcLexemeAnalysis = window.LexemeAnalysis.analyze(this.pcInput);
|
||||
},
|
||||
pcRunMutation: async function() {
|
||||
const apiKey = this.pcGetApiKey();
|
||||
if (!apiKey) {
|
||||
@@ -163,6 +171,39 @@ class PromptCraftTool extends Tool {
|
||||
},
|
||||
pcUseAsInput: function(text) {
|
||||
this.pcInput = text;
|
||||
},
|
||||
pcGetLexemeAnalysis: function() {
|
||||
return this.pcLexemeAnalysis || { totalFindings: 0, findings: [], summary: 'No Latin-root wording findings.' };
|
||||
},
|
||||
pcNeutralizeInput: function() {
|
||||
const analysis = this.pcGetLexemeAnalysis();
|
||||
if (!analysis.totalFindings || !window.LexemeAnalysis || typeof window.LexemeAnalysis.neutralizeText !== 'function') {
|
||||
return;
|
||||
}
|
||||
this.pcInput = window.LexemeAnalysis.neutralizeText(this.pcInput, analysis);
|
||||
if (typeof this.showNotification === 'function') {
|
||||
this.showNotification('Applied neutral Latin-root rewrites', 'success', 'fas fa-seedling');
|
||||
}
|
||||
},
|
||||
pcApplyLexemeRewrite: function(term, rewrite) {
|
||||
if (!term || !rewrite) {
|
||||
return;
|
||||
}
|
||||
const escapedTerm = String(term).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
this.pcInput = this.pcInput.replace(new RegExp('\\b' + escapedTerm + '\\b', 'i'), rewrite);
|
||||
if (typeof this.showNotification === 'function') {
|
||||
this.showNotification('Applied rewrite for ' + term, 'success', 'fas fa-pen');
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
getVueWatchers() {
|
||||
return {
|
||||
pcInput: function() {
|
||||
if (typeof this.pcRefreshLexemeAnalysis === 'function') {
|
||||
this.pcRefreshLexemeAnalysis();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user