update(AutoTag) new tags and remove spaces at the start of tags textfield

This commit is contained in:
SansGuidon 2024-12-04 14:37:24 +00:00
parent 7c85fc0e19
commit e2eee79ff5

View File

@ -7,6 +7,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
// Configure keywords and tags based on provided rules
$conf->setEmpty('plugins.AUTO_TAG_KEYWORDS', [
'accessibility,web development,web design,html,css' => 'web-development',
'accounting' => 'accounting',
'adhd,tdah' => 'adhd',
'alternative,compatible,migrated,migration' => 'alternatives',
'anxi,burnout' => 'health-and-wellness',
@ -24,13 +25,16 @@ function auto_tag_plugin_init(ConfigManager $conf)
'calm tech,calmness,calm' => 'calm-tech',
'cheatsheet,cheat sheet,cheat-sheet' => 'cheatsheet,guides-and-tips',
'cloud,aws,amazon' => 'cloud',
'comics' => 'comics,reading-and-literature,may-read,culture',
'(comic),-comic-,comics' => 'comics,reading-and-literature,may-read,culture,humor',
'comparison,comparer, vs ,versus' => 'comparison',
'communicate,communication,messaging,messenger,gmail' => 'communication',
'complex' => 'complexity, its-complicated',
'complex,impossible to solve,complicated,very difficult' => 'complexity, its-complicated',
'configure,configuration' => 'configuration',
'databases,RDS' => 'databases',
'data collection' => 'data-collection',
'data transfer' => 'data-portability',
'debug,troubleshoot,diagnose,resolution,solution,problem,solv,trouble' => 'problem-solving,guides-and-tips',
'degoogl' => 'freedom',
'design' => 'design',
'development workflow' => 'devex',
'disk' => 'storage',
@ -47,9 +51,9 @@ function auto_tag_plugin_init(ConfigManager $conf)
'explor,going deep' => 'discovery',
'fediverse' => 'privacy-and-security,freedom,social-media',
'libre' => 'freedom',
'libre,software,logiciel' => 'free-software',
'logiciel libre,free software,logiciel gratuit' => 'free-software',
'from home,remote work,work remote' => 'remote-work',
'big-tech,gafam' => 'big-tech',
'big-tech,gafam,degoogl' => 'big-tech',
'game,jeu vidéo,game dev' => 'games',
'gender,homosexualité,hétérosexualité,les sexes,caractères sexuels' => 'gender',
'gratuit,free' => 'free',
@ -57,6 +61,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'git,gitlab' => 'version-control',
'gpt,chatgpt,llm,artificial intelligence,intelligence artificielle,l\'ia' => 'ai',
'health,healthy,nutrition,food,alimentation,nourriture' => 'health-and-wellness,food',
'humans,humains' => 'humans',
'humor,humour' => 'humor',
'inspiration,creativity,creative' => 'inspiration',
'lambic,gueuze,beer,bière' => 'beer-and-brewing',
@ -65,7 +70,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'low-tech,low tech' => 'low-tech',
'merdification,enshittif,AI-generated,crapification,decline in quality' => 'enshittification',
'monitoring,metrics' => 'monitoring,metrics',
'music,spotify' => 'music',
'music,spotify,radios,webradios' => 'music',
'newsletter' => 'newsletter,news,may-subscribe',
'nostalg' => 'nostalgia',
'obsidian,note taking,note-taking,knowledge manag' => 'knowledge-management',
@ -75,20 +80,25 @@ function auto_tag_plugin_init(ConfigManager $conf)
'philosoph' => 'philosophy',
'photography' => 'photography,photos',
'podcast' => 'podcast',
'ego,narciss' => 'psychology,ego',
'psycholog' => 'psychology',
'voting,politic,politique' => 'politics',
'python' => 'python,software-development,code',
'privatebin' => 'secrets',
'problem,solv,trouble' => 'problem-solving',
'programming languages' => 'codeccomputer-languages',
'recycling,sustainab,green web,climate' => 'ecology',
'reviews,critique' => 'reviews',
'rss,rss feed,miniflux' => 'content-aggregation,content-curation',
'ruby' => 'ruby,software-development,code',
'science' => 'science',
'scripting,jq' => 'scripting',
'search engine' => 'search-engines',
'security,permission,sécurité,secure,privacy,private,degoogl,gdpr,data protection,online tracking,user profiling,anonymo,anonymi,surveillance,malware,spyware,decentrali,secrets,privacy matters,vpn' => 'privacy-and-security',
'simplicity,minimal,less,declutter,stopped using,simple,simplif,reduction in,fewer' => 'minimalism',
'simplicity,minimal,less,declutter,stopped using,simple,simplif,reduction in,fewer,no longer needed' => 'minimalism',
'small web,indie web,indieweb' => 'small-web',
'smartphone,android,mobile,phone' => 'mobile',
'teamwork,collaborat,équipe' => 'collaboration',
'teamwork,collaborat,équipe,cooperat,coordinat' => 'collaboration',
'technology' => 'technology',
'test' => 'testing',
'to do,to-do' => 'todo',
@ -97,7 +107,8 @@ function auto_tag_plugin_init(ConfigManager $conf)
'.txt' => 'text-files',
'vpn' => 'privacy-and-security',
'wordpress,personal website,blog roll,blogroll,blogosphere,webring,digital garden' => 'blogging',
'youtube.com,invidious,peertube,watch?v' => 'to-watch,video'
'youtube.com,invidious,peertube,watch?v' => 'to-watch,video',
'zoemp' => 'zoemp'
]);
}
@ -183,8 +194,10 @@ function apply_auto_tags(array $data, ConfigManager $conf): array
$tagsToAdd = filter_and_limit_tags($tagScores);
$tagsToAdd[] = 'auto-tagged'; // Added a fixed tag
$existingTags = explode(' ', $data['link']['tags']);
$data['link']['tags'] = implode(' ', array_unique(array_merge($existingTags, $tagsToAdd)));
$existingTags = array_map('trim', explode(' ', $data['link']['tags']));
$tagsToAdd = array_map('trim', $tagsToAdd);
$data['link']['tags'] = trim(implode(' ', array_filter(array_unique(array_merge($existingTags, $tagsToAdd)))));
return $data;
}