Skip to content

Commit

Permalink
Fix some accented names
Browse files Browse the repository at this point in the history
Anduril has been in here a while as has Barad-Dur but I see both being rejected
in the last 30 days. I think because what gets spat out is three crazy chars and
not two so I altered the regexes to account for that.

We should probably come up with some general solve for this but this is all the
problems I saw from the last 30 days after spot-checking a bunch.
  • Loading branch information
bakert committed May 24, 2024
1 parent 5e3f93d commit 95103be
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions PDBot.Core/Data/CardName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public class CardName : IEquatable<CardName>, IEquatable<string>
static readonly Regex Junun = new("Jun.{1,2}n Efreet", RegexOptions.Compiled);
static readonly Regex Marton = new("M.{1,2}rton Stromgald", RegexOptions.Compiled);
static readonly Regex IfhBiff = new("Ifh-B.{1,2}ff Efreet", RegexOptions.Compiled);
static readonly Regex BaradDur = new("Barad-d.{1,2}r", RegexOptions.Compiled);
static readonly Regex BaradDur = new("Barad-d.{1,3}r", RegexOptions.Compiled);
static readonly Regex Theoden = new("Th.{1,2}den", RegexOptions.Compiled);
static readonly Regex Andúril = new("And.{1,2}ril", RegexOptions.Compiled);
static readonly Regex Andúril = new("And.{1,3}ril", RegexOptions.Compiled);
static readonly Regex Dúnedain = new("D.{1,2}nedain", RegexOptions.Compiled);
static readonly Regex Lothlórien = new("Lothl.{1,2}rien", RegexOptions.Compiled);
static readonly Regex Glóin = new("Gl.{1,2}in", RegexOptions.Compiled);
Expand All @@ -32,8 +32,11 @@ public class CardName : IEquatable<CardName>, IEquatable<string>
static readonly Regex Tinúviel = new("Tin.{1,2}viel", RegexOptions.Compiled);
static readonly Regex Théoden = new("Th.{1,2}oden", RegexOptions.Compiled);
static readonly Regex Kennerüd = new("Kenner.{1,2}d", RegexOptions.Compiled);
static readonly Regex Éomer = new(".{1,2}omer", RegexOptions.Compiled);
static readonly Regex Éowyn = new(".{1,2}owyn", RegexOptions.Compiled);
static readonly Regex ÉomerOfTheRiddermark = new(".{1,3}omer of the Riddermark", RegexOptions.Compiled);
static readonly Regex ÉomerMarshalOfRohan = new(".{1,3}omer, Marshal of Rohan", RegexOptions.Compiled);
static readonly Regex Éowyn = new(".{1,3}owyn", RegexOptions.Compiled);
static readonly Regex Bartolomé = new("Bartolom.{1,3}", RegexOptions.Compiled);
static readonly Regex Grishnákh = new ("Grishn.{1,2}kh", RegexOptions.Compiled);

/// <summary>
/// Takes a name, and fixes up any messy encoding issues that might have occured.
Expand Down Expand Up @@ -64,8 +67,11 @@ public static string FixAccents(string name)
name = Sméagol.Replace(name, "Sméagol");
name = Tinúviel.Replace(name, "Tinúviel");
name = Théoden.Replace(name, "Théoden");
name = Éomer.Replace(name, "Éomer");
name = ÉomerOfTheRiddermark.Replace(name, "Éomer of the Riddermark");
name = ÉomerMarshalOfRohan.Replace(name, "Éomer, Marshal of Rohan");
name = Éowyn.Replace(name, "Éowyn");
name = Bartolomé.Replace(name, "Bartolomé");
name = Grishnákh.Replace(name, "Grishnákh");
return name;
}

Expand Down

0 comments on commit 95103be

Please sign in to comment.