Improve producer matching - Add tissue service

Tissue service will sanitize the existign database of ingested torrents by matching existing titles with new banned word lists. Now with added kleenex
This commit is contained in:
iPromKnight
2024-03-12 10:29:13 +00:00
parent e24d81dd96
commit 79a6aa3cb0
28 changed files with 257591 additions and 37 deletions

View File

@@ -1,7 +1,24 @@
namespace Producer.Extensions;
public static class StringExtensions
public static partial class StringExtensions
{
[GeneratedRegex("[^a-zA-Z0-9 ]")]
private static partial Regex NotAlphaNumeric();
private static readonly char[] separator = [' '];
public static bool IsNullOrEmpty(this string? value) =>
string.IsNullOrEmpty(value);
public static string NormalizeTitle(this string title)
{
var alphanumericTitle = NotAlphaNumeric().Replace(title, " ");
var words = alphanumericTitle.Split(separator, StringSplitOptions.RemoveEmptyEntries)
.Select(word => word.ToLower());
var normalizedTitle = string.Join(" ", words);
return normalizedTitle;
}
}