Update other categorization

This commit is contained in:
DariusIII
2026-04-21 22:13:34 +02:00
parent bd7f540c23
commit bbc54feaf2
5 changed files with 113 additions and 2 deletions
+18 -1
View File
@@ -264,6 +264,23 @@ trait DetectsHashedNames
return preg_match('/[aeiou]/i', $letterOnly) !== 1;
}
/**
* Check whether the letter-only portion of a token has a normal vowel ratio.
*/
protected function hasNormalVowelRatio(string $str, float $min = 0.2): bool
{
$letters = preg_replace('/[^a-z]/i', '', $str);
if ($letters === '' || strlen($letters) < 5) {
return false;
}
preg_match_all('/[aeiou]/i', $letters, $matches);
$vowelCount = count($matches[0]);
return ($vowelCount / strlen($letters)) >= $min;
}
/**
* Check if a string looks like a random/obfuscated string rather than a real title.
*
@@ -315,7 +332,7 @@ trait DetectsHashedNames
protected function stripExtensionsForAnalysis(string $name): string
{
return preg_replace(
'/\.(mkv|avi|mp4|m4v|mpg|mpeg|wmv|flv|mov|ts|vob|iso|divx|par2?|nfo|sfv|nzb|rar|r\d{2,3}|zip|7z|gz|tar|001)$/i',
'/\.(mkv|avi|mp4|m4v|mpg|mpeg|wmv|flv|mov|ts|vob|iso|divx|par2?|nfo|sfv|nzb|rar|r\d{2,3}|zip|7z|gz|tar|001|msix|msixbundle|appx|appxbundle|apk|xap|ipa|deb|rpm|pkg|dmg|exe|msi)$/i',
'',
trim($name)
);