feat(autotag) manage empty tags and add more rules

This commit is contained in:
SansGuidon 2025-01-21 08:57:44 +00:00
parent ef373c5e67
commit 16e40ee20b

View File

@ -40,7 +40,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'database,databases,RDS,base de données' => 'databases',
'data collection,collecte de données' => 'data-collection',
'data transfer,transfert de données' => 'data-portability',
'debug,troubleshoot,diagnose,résoudre,diagnostiquer,troubleshooting' => 'problem-solving,guides-and-tips,debugging',
'debug,troubleshoot,diagnose,résoudre,diagnostiquer,troubleshooting,find a solution' => 'problem-solving,guides-and-tips,debugging',
'design,designs' => 'design',
'development workflow,devex,flux de développement' => 'devex',
'disk,disque,disques' => 'storage',
@ -67,7 +67,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'gratuit,free' => 'free',
'gitops,gitlab,github actions,devops,SRE,ci/cd,platform-engineering,ci pipeline,application deployment,dagger,renovatebot,dependabot,continuous integration,site reliability eng' => 'devops',
'git,gitlab,jujutsu,pijul,mercurial,svn,version control,contrôle de version' => 'version-control',
'gpt,chatgpt,llm,llms,artificial intelligence,intelligence artificielle,IA,l\'ia,ai model,an ai' => 'ai',
'gpt,chatgpt,llm,llms,artificial intelligence,intelligence artificielle,IA,l\'ia,ai,ai model,an ai' => 'ai',
'hacking,piratage' => 'hacking',
'nutrition,food,alimentation,nourriture,recette,recette de cuisine,recettes de cuisine,ingrédients,cette recette,beurre,cuisine' => 'food',
'history,histoire,documentaire,documentary' => 'history',
@ -94,7 +94,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'photography,photos,photographie' => 'photos',
'podcast,podcasts' => 'podcast',
'ego,narcissism,narcissist,narcissisme,psycholog,psychologie' => 'psychology',
'voting,politic,politique,vote' => 'politics',
'voting,politic,politique,vote,multiculturalism,culturalism,cultural integration,political' => 'politics',
'python,logiciels en python' => 'python,software-development,code',
'privatebin' => 'secrets',
'programming languages,langages de programmation' => 'code,computer-languages',
@ -102,6 +102,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'quality,qualité' => 'quality',
'recommandations,recommendation,conseils' => 'recommandations,recommendations',
'recycling,sustainable,green web,climate,recyclage,web écologique,climat,ai emissions,water use,emissions produced,amount of co2,global co2,co2 emissions,car bloat,environnement,environment,environmental,environmentally,plasic waste' => 'ecology',
'relationship,relationships,de rencontre' => 'relationships',
'religion,chretiens,bible,coran,islam,musulmans,croyants,athée,la foi,église' => 'philosophy',
'reviews,critique,avis' => 'reviews',
'rss,rss feed,miniflux,web reader,lecteur web' => 'content-aggregation,content-curation',
@ -109,13 +110,14 @@ function auto_tag_plugin_init(ConfigManager $conf)
'science,sciences' => 'science',
'scripting,jq,curl,wget,script,bash,terminal,bash script,script python,python script,lua,script shell,script bash,shell script' => 'scripting',
'search engine,moteur de recherche' => '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,passkey,protéger' => 'privacy-and-security',
'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,passkey,protéger,password manager' => 'privacy-and-security',
'simplicity,minimal,declutter,stopped using,simple,simplification,simplifier,reduction in,no longer needed,minimalisme,simplicité,réduction' => 'minimalism',
'small web,indie web,indieweb,petit web' => 'small-web',
'smartphone,android,mobile,phone,téléphone,sms' => 'mobile',
'snippet,extrait de code' => 'code',
'static site,static-site,site statique' => 'static-site,static-web',
'social media,réseau social,fediverse,fédiverse,réseaux sociaux,social networks,social network' => 'social-media',
'society,societies' => 'society',
'teamwork,collaborat,équipe,cooperat,coordinat,travail équipe' => 'collaboration',
'technology,technologie' => 'technology',
'template,modèle' => 'template',
@ -124,7 +126,7 @@ function auto_tag_plugin_init(ConfigManager $conf)
'markdown,text files,fichiers texte,formats,text-based,plaintext,markup language,markdown,plain text,basé sur du texte,langage balisé' => 'plaintext,formats,text-files',
'time to update,maintainers,tech-debt,legacy code,long term software,temps pour mettre à jour' => 'maintenance,tech-debt',
'to do,to-do,à faire' => 'todo',
'tool,resources,a script,outil,a collection,a catalog,awesome list,links,outils,ressources' => 'tools-and-resources',
'tool,resources,a script,outil,a collection,a catalog,awesome list,links,outils,ressources,password manager' => 'tools-and-resources',
'training,course,conference talk,learning,homeschool,expert,specializ,tacit knowledge,tribal knowledge,formation,cours,conférence,apprentissage' => 'education',
'.txt,text-based,fichiers txt' => 'text-files',
'ui,interfaces utilisateur' => 'ui',
@ -191,13 +193,19 @@ function filter_and_limit_tags(array $tagScores, int $minScore = 2, int $maxTags
return $score >= $minScore;
});
// Determine the maximum score
$maxScore = max($filteredTags);
// Check if $filteredTags is not empty to avoid max() error
if (!empty($filteredTags)) {
// Determine the maximum score
$maxScore = max($filteredTags);
// Remove tags with a score less than half of the maximum score
$filteredTags = array_filter($filteredTags, function ($score) use ($maxScore) {
return $score > ($maxScore / 2);
});
// Remove tags with a score less than half of the maximum score
$filteredTags = array_filter($filteredTags, function ($score) use ($maxScore) {
return $score > ($maxScore / 2);
});
} else {
// If no tags pass the filter, return an empty array
$filteredTags = [];
}
// Sort tags by descending score
arsort($filteredTags);