mirror of
https://github.com/elder-plinius/P4RS3LT0NGV3.git
synced 2026-06-06 06:53:56 +02:00
8ff45957c8
Made-with: Cursor
26 lines
702 B
JavaScript
26 lines
702 B
JavaScript
// remove punctuation transform
|
|
import BaseTransformer from '../BaseTransformer.js';
|
|
|
|
export default new BaseTransformer({
|
|
name: 'Remove Punctuation',
|
|
priority: 50,
|
|
category: 'format',
|
|
func: function(text) {
|
|
return text.replace(/[.,!?;:'"()\-_\[\]{}@#$%^&*+=|\\\/<>~`]/g, '');
|
|
},
|
|
reverse: function(text) {
|
|
// Cannot reverse - punctuation is lost
|
|
return text;
|
|
},
|
|
preview: function(text) {
|
|
if (!text) return '[no-punct]';
|
|
return this.func(text.slice(0, 10));
|
|
},
|
|
canDecode: false,
|
|
detector: function(text) {
|
|
// Hard to detect - would need to check if text should have punctuation
|
|
return false;
|
|
}
|
|
});
|
|
|