private int FuzzyMatchAPIName(string apiName, string name)
        {
            Regex  rgx           = new Regex("[^a-zA-Z ]");
            string processedName = string.Concat("achievement_", rgx.Replace(name, "").Replace(" ", "_").ToLower());

            return(Fuzz.Ratio(apiName, processedName));
        }
        public UniqueEquipment GetUniqueEquipmentByCharacterName(string name)
        {
            name = aliases.ResolveAlias(name);

            var character = dbContext.Characters.FirstOrDefault(x => x.Name.ToLower() == name.ToLower());

            if (character == null)
            {
                character = dbContext.Characters.OrderByDescending(x => Fuzz.PartialRatio(x.Name.ToLower(), name.ToLower())).FirstOrDefault();
            }

            var sheetUniques   = dbContext.UniqueEquipment.Where(x => x.Character == character.Name);
            var sheetUniqueSet = dbContext.UniqueEquipmentSets.FirstOrDefault(x => x.Character == character.Name);
            var uniqueEquip    = new UniqueEquipment
            {
                UniqueEquipments = sheetUniques.Select(x => new UniqueEquip {
                    Info = x
                }).ToList(),
                UniqueEquipmentSets = new UniqueEquipmentSet {
                    Info = sheetUniqueSet
                },
                CharacterUrl = character.CharacterImage
            };

            return(uniqueEquip);
        }
        public double GetSimilarPoints(Trip source, Trip other)
        {
            double points = 0;

            // Same tour type
            if (source.Tour.Type == other.Tour.Type)
            {
                points += 75;
            }

            // Same start place and/or destination
            if (Fuzz.PartialRatio(source.Tour.StartPlace, other.Tour.StartPlace) >= 85)
            {
                points += 50;
            }
            if (Fuzz.PartialRatio(source.Tour.Destination, other.Tour.Destination) >= 85)
            {
                points += 50;
            }

            // Similar Price
            points -= Convert.ToDouble(Math.Abs(source.GetSalePrice() - other.GetSalePrice()));

            // Similar Start Time and End Time
            points += 25 - (source.StartTime - other.StartTime).TotalDays;
            points += 25 - (source.EndTime - other.EndTime).TotalDays;

            // Similar Description
            points += Fuzz.TokenSetRatio(source.Tour.Description, other.Tour.Description) * .25;

            return(points);
        }
Esempio n. 4
0
        internal override bool Query()
        {
            using (SQLConnection sql = new SQLConnection(instance))
            {
                sql.BuildConnectionString(credentials);
                if (!sql.Connect())
                {
                    return(false);
                }

                for (int i = start; i <= end; i++)
                {
                    string query1_1 = string.Format(
                        "SELECT \'{0}\' as [ComputerName],\n" +
                        "\'{1}\' as [Instance],\n" +
                        "\'{2}\' as [DatabaseId],\n" +
                        "DB_NAME({2}) as [DatabaseName]",
                        computerName, instance, i
                        );
#if DEBUG
                    Console.WriteLine(query1_1);
#endif
                    table = sql.Query(query1_1);

                    foreach (DataRow row in table.AsEnumerable())
                    {
                        try
                        {
                            Fuzz f = new Fuzz
                            {
                                ComputerName = computerName,
                                Instance     = instance,
                                DatabaseId   = (string)row["DatabaseId"],
                            };
                            if (!(row["DatabaseName"] is DBNull))
                            {
                                f.DatabaseName = (string)row["DatabaseName"];
                            }
#if DEBUG
                            Misc.PrintStruct <Fuzz>(f);
#endif
                            fuzzed.Add(f);
                        }
                        catch (Exception ex)
                        {
                            if (ex is ArgumentNullException)
                            {
                                continue;
                            }
                            else
                            {
                                Console.WriteLine(ex.Message);
                            }
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
        public double GetSimilarPoints <T>(IPost <T> source, IPost <T> other) where T : IEmployee
        {
            double points = 0;

            // Same author
            if (source.OwnerID == other.OwnerID)
            {
                points += 50;
            }

            // Same category
            if (source.Category == other.Category)
            {
                points += 50;
            }

            // Similar title
            points += Fuzz.PartialTokenSetRatio(source.Title, other.Title);

            // Similar tags
            points += Fuzz.PartialTokenSetRatio(string.Join(" ", source.Tags), string.Join(" ", other.Tags));

            // Close date of publish
            points -= (source.LastUpdated - other.LastUpdated).TotalDays;

            return(points);
        }
        public List <SheetSoulbreaks> GetSoulbreaksByCharacterName(string tier, string name, int?index = null)
        {
            var charNames = dbContext.Characters.Select(x => x.Name.ToLower());

            name = aliases.ResolveAlias(name);

            if (!charNames.Contains(name.ToLower()))
            {
                name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
            }

            List <SheetSoulbreaks> soulbreaks = new List <SheetSoulbreaks>();

            if (tier == "g")
            {
                soulbreaks = dbContext.Soulbreaks.Where(x => (x.Character.ToLower() == name.ToLower() || x.SoulbreakId == name) && (x.Tier == "Glint" || x.Tier == "Glint+")).ToList();
            }
            else if (tier == "brave")
            {
                soulbreaks = dbContext.Soulbreaks.Where(x => (x.Character.ToLower() == name.ToLower() || x.SoulbreakId == name) && x.Effects.Contains("[Brave Mode]")).ToList();
            }
            else
            {
                soulbreaks = dbContext.Soulbreaks.Where(x => (x.Character.ToLower() == name.ToLower() || x.SoulbreakId == name) && x.Tier == tier).ToList();
            }

            if (index != null)
            {
                return(soulbreaks.Where(x => x.SoulbreakVersion.EndsWith(index.ToString())).ToList());
            }

            return(soulbreaks);
        }
Esempio n. 7
0
 public void TestEmptyStringsScore0()
 {
     Assert.That(Fuzz.Ratio("test_string", ""), Is.EqualTo(0));
     Assert.That(Fuzz.PartialRatio("test_string", ""), Is.EqualTo(0));
     Assert.That(Fuzz.Ratio("", ""), Is.EqualTo(0));
     Assert.That(Fuzz.PartialRatio("", ""), Is.EqualTo(0));
 }
        public async Task <IActionResult> SubmitAnswer(int qId, string answer)
        {
            Question question = await _context.Questions.Include(q => q.QuestionCategory).FirstOrDefaultAsync(q => q.QuestionId == qId);

            string stored = question.Answer.ToLower();
            string input  = answer.ToLower().Trim();

            //Check for number vs word digit representation match by converting number to word.
            if (int.TryParse(stored, out int numStored))
            {
                stored = numStored.ToWords();
            }

            if (int.TryParse(input, out int inputStored))
            {
                input = inputStored.ToWords();
            }

            //Perform fuzzy matching using Levenshtein distance and consider 90% match a success
            int  ratio   = Fuzz.Ratio(stored, input);
            bool success = ratio >= 90;

            if (success)
            {
                CurrentScore       += question.QuestionCategory.ScoreWeight;
                _currentUser.Money += question.QuestionCategory.ScoreWeight;

                _context.Entry(_currentUser).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                Visited.Add(qId);
            }

            return(Json(new { success, currentScore = CurrentScore }));
        }
 public IEnumerable <IPost <T> > ApplyFilter <T>(IEnumerable <IPost <T> > posts, BlogFilterParams filterParams) where T : IEmployee
 {
     return(posts.Where(post => !post.IsSoftDeleted &&
                        (filterParams.Category == null || (int)post.Category == (int)filterParams.Category) &&
                        (string.IsNullOrWhiteSpace(filterParams.Keyword) || Fuzz.PartialTokenSetRatio(string.Join(" ", post.Tags), filterParams.Keyword) > 50 || Fuzz.PartialTokenSetRatio(post.Title, filterParams.Keyword) > 50)
                        ).OrderBy(post => string.IsNullOrWhiteSpace(filterParams.Keyword) ? 1: -Fuzz.PartialTokenSetRatio(post.Title, filterParams.Keyword) * 1.5 - Fuzz.PartialTokenSetRatio(string.Join(" ", post.Tags), filterParams.Keyword)));
 }
        public List <SheetLegendMaterias> GetLegendMateriasByCharName(string name)
        {
            var charNames   = dbContext.Characters.Select(x => x.Name.ToLower());
            var materiaName = dbContext.LegendMaterias.Select(x => x.Name.ToLower()).FirstOrDefault(x => x == name.ToLower());
            var jpName      = dbContext.LegendMaterias.FirstOrDefault(x => x.JPName == name);

            if (materiaName == null && jpName == null)
            {
                name = aliases.ResolveAlias(name);

                if (!charNames.Contains(name.ToLower()))
                {
                    name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
                }
            }

            if (jpName != null)
            {
                return(new List <SheetLegendMaterias>()
                {
                    jpName
                });
            }

            var legendMaterias = dbContext.LegendMaterias.Where(x => x.Character.ToLower() == name.ToLower() || x.Name.ToLower() == name.ToLower() || name == x.JPName).ToList();

            return(legendMaterias);
        }
Esempio n. 11
0
        private void CalcQuestionIsNextPossibility()
        {
            if (QuestionsNotAsked.Count == 0 || AnswersAll.Count == 0)
            {
                return;
            }

            var answersWithMaxPoss = AnswersAll.Where(a => a.Possibility == AnswersAll[0].Possibility).ToList()[0];;

            foreach (var q in QuestionsNotAsked)
            {
                float maxChangeOfPossibility = 0;

                List <float> diffPosForReactions = new List <float>();

                foreach (Reaction react in Enum.GetValues(typeof(Reaction)))
                {
                    var tmp = ExactReactionOnQuestionRelativelyAnswerPossibility(react, q, answersWithMaxPoss);

                    diffPosForReactions.Add(tmp);
                }

                q.PossibilityOfThisIsNext = Fuzz.Or(diffPosForReactions.ToArray());
            }

            QuestionsAll = QuestionsAll.OrderByDescending(o => o.PossibilityOfThisIsNext).ToList();
        }
Esempio n. 12
0
        public void UpdateOrderScore(string SearchString)
        {
            int score1 = Fuzz.Ratio(SearchString, CargoCollection.PreciseCargoName);
            int score2 = Fuzz.Ratio(SearchString, CargoCollection.Cargo.CargoName);

            OrderScore = Math.Max(score1, score2);
        }
Esempio n. 13
0
 public void TestTokenSetRatio()
 {
     Assert.AreEqual(Fuzz.TokenSetRatio(_s4, _s5, PreprocessMode.Full), 100);
     Assert.AreEqual(Fuzz.TokenSetRatio(_s8, _s8A), 100);
     Assert.AreEqual(Fuzz.TokenSetRatio(_s9, _s9A, PreprocessMode.Full), 100);
     Assert.AreEqual(Fuzz.TokenSetRatio(_s9, _s9A), 100);
     Assert.AreEqual(Fuzz.TokenSetRatio(_s10, _s10A), 50);
 }
Esempio n. 14
0
        public void TestPartialRatioUnicodeString()
        {
            _s1 = "\u00C1";
            _s2 = "ABCD";
            var score = Fuzz.PartialRatio(_s1, _s2);

            Assert.AreEqual(0, score);
        }
Esempio n. 15
0
 public void TestPartialTokenSortRatio()
 {
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s1, _s1A, PreprocessMode.Full), 100);
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s4, _s5, PreprocessMode.Full), 100);
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s8, _s8A), 100);
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s9, _s9A, PreprocessMode.Full), 100);
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s9, _s9A), 100);
     Assert.AreEqual(Fuzz.PartialTokenSortRatio(_s10, _s10A), 50);
 }
Esempio n. 16
0
        public void Evaluate()
        {
            var a1 = Fuzz.Ratio("mysmilarstring", "myawfullysimilarstirng");
            var a2 = Fuzz.Ratio("mysmilarstring", "mysimilarstring");

            var b1 = Fuzz.PartialRatio("similar", "somewhresimlrbetweenthisstring");

            var c1 = Fuzz.TokenSortRatio("order words out of", "  words out of order");
            var c2 = Fuzz.PartialTokenSortRatio("order words out of", "  words out of order");

            var d1 = Fuzz.TokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear");
            var d2 = Fuzz.PartialTokenSetRatio("fuzzy was a bear", "fuzzy fuzzy fuzzy bear");

            var e1 = Fuzz.WeightedRatio("The quick brown fox jimps ofver the small lazy dog", "the quick brown fox jumps over the small lazy dog");

            var f1 = Fuzz.TokenInitialismRatio("NASA", "National Aeronautics and Space Administration");
            var f2 = Fuzz.TokenInitialismRatio("NASA", "National Aeronautics Space Administration");

            var f3 = Fuzz.TokenInitialismRatio("NASA", "National Aeronautics Space Administration, Kennedy Space Center, Cape Canaveral, Florida 32899");
            var f4 = Fuzz.PartialTokenInitialismRatio("NASA", "National Aeronautics Space Administration, Kennedy Space Center, Cape Canaveral, Florida 32899");

            var g1 = Fuzz.TokenAbbreviationRatio("bl 420", "Baseline section 420", PreprocessMode.Full);
            var g2 = Fuzz.PartialTokenAbbreviationRatio("bl 420", "Baseline section 420", PreprocessMode.Full);



            var h1 = Process.ExtractOne("cowboys", new[] { "Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys" });
            var h2 = string.Join(", ", Process.ExtractTop("goolge", new[] { "google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl" }, limit: 3));
            var h3 = string.Join(", ", Process.ExtractAll("goolge", new [] { "google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl" }));
            var h4 = string.Join(", ", Process.ExtractAll("goolge", new[] { "google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl" }, cutoff: 40));
            var h5 = string.Join(", ", Process.ExtractSorted("goolge", new [] { "google", "bing", "facebook", "linkedin", "twitter", "googleplus", "bingnews", "plexoogl" }));

            var i1 = Process.ExtractOne("cowboys", new[] { "Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys" }, s => s, ScorerCache.Get <DefaultRatioScorer>());

            var events = new[]
            {
                new[] { "chicago cubs vs new york mets", "CitiField", "2011-05-11", "8pm" },
                new[] { "new york yankees vs boston red sox", "Fenway Park", "2011-05-11", "8pm" },
                new[] { "atlanta braves vs pittsburgh pirates", "PNC Park", "2011-05-11", "8pm" },
            };
            var query = new[] { "new york mets vs chicago cubs", "CitiField", "2017-03-19", "8pm" };

            var best = Process.ExtractOne(query, events, strings => strings[0]);

            var ratio                    = ScorerCache.Get <DefaultRatioScorer>();
            var partial                  = ScorerCache.Get <PartialRatioScorer>();
            var tokenSet                 = ScorerCache.Get <TokenSetScorer>();
            var partialTokenSet          = ScorerCache.Get <PartialTokenSetScorer>();
            var tokenSort                = ScorerCache.Get <TokenSortScorer>();
            var partialTokenSort         = ScorerCache.Get <PartialTokenSortScorer>();
            var tokenAbbreviation        = ScorerCache.Get <TokenAbbreviationScorer>();
            var partialTokenAbbreviation = ScorerCache.Get <PartialTokenAbbreviationScorer>();
            var weighted                 = ScorerCache.Get <WeightedRatioScorer>();
        }
Esempio n. 17
0
        public void TestIssueSeven()
        {
            _s1 = "HSINCHUANG";
            _s2 = "SINJHUAN";
            _s3 = "LSINJHUANG DISTRIC";
            _s4 = "SINJHUANG DISTRICT";

            Assert.IsTrue(Fuzz.PartialRatio(_s1, _s2) > 75);
            Assert.IsTrue(Fuzz.PartialRatio(_s1, _s3) > 75);
            Assert.IsTrue(Fuzz.PartialRatio(_s1, _s4) > 75);
        }
Esempio n. 18
0
        public void TokenInitialismScorer_WhenGivenStringWithTrailingSpaces_DoesNotBreak()
        {
            // arrange
            var longer  = "lusiki plaza share block ";
            var shorter = "jmft";

            // act
            var ratio = Fuzz.TokenInitialismRatio(shorter, longer);

            // assert
            Assert.IsTrue(ratio >= 0);
        }
Esempio n. 19
0
        public void TestIssueEight()
        {
            // https://github.com/JakeBayer/FuzzySharp/issues/8
            Assert.AreEqual(100, Fuzz.PartialRatio("Partnernummer", "Partne\nrnum\nmerASDFPartnernummerASDF")); // was 85
            Assert.AreEqual(100, Fuzz.PartialRatio("Partnernummer", "PartnerrrrnummerASDFPartnernummerASDF"));  // was 77

            // https://github.com/xdrop/fuzzywuzzy/issues/39
            Assert.AreEqual(100, Fuzz.PartialRatio("kaution", "kdeffxxxiban:de1110010060046666666datum:16.11.17zeit:01:12uft0000899999tan076601testd.-20-maisonette-z4-jobas-hagkautionauszug")); // was 57

            // https://github.com/seatgeek/fuzzywuzzy/issues/79
            Assert.AreEqual(100, Fuzz.PartialRatio("this is a test", "is this is a not really thing this is a test!")); // was 92 (actually 93)
        }
Esempio n. 20
0
        public SheetMagicites GetMagiciteByName(string name)
        {
            name = aliases.ResolveAlias(name);

            var magicite = dbContext.Magicites.FirstOrDefault(x => x.Name.ToLower() == name.ToLower() || x.JPName == name);

            if (magicite == null)
            {
                magicite = dbContext.Magicites.OrderByDescending(x => Fuzz.PartialRatio(x.Name.ToLower(), name.ToLower())).FirstOrDefault();
            }

            return(magicite);
        }
Esempio n. 21
0
        public SheetStatus GetStatusByName(string name)
        {
            name = aliases.ResolveAlias(name);

            var status = dbContext.Statuses.FirstOrDefault(x => x.Name.ToLower() == name.ToLower() || x.StatusId == name);

            if (status == null)
            {
                status = dbContext.Statuses.OrderByDescending(x => Fuzz.PartialRatio(x.Name.ToLower(), name.ToLower())).FirstOrDefault();
            }

            return(status);
        }
        public SheetCharacters GetCharacterByName(string name)
        {
            name = aliases.ResolveAlias(name);

            var character = dbContext.Characters.FirstOrDefault(x => x.Name.ToLower() == name.ToLower());

            if (character == null)
            {
                character = dbContext.Characters.OrderByDescending(x => Fuzz.PartialRatio(x.Name.ToLower(), name.ToLower())).FirstOrDefault();
            }

            return(character);
        }
Esempio n. 23
0
 public IEnumerable <Trip> ApplyFilter(IEnumerable <Trip> trips, TripFilterParams filterParams)
 {
     return(trips.Where(trip => trip.CanBook(DateTime.Now) &&
                        (filterParams.TourID == null || trip.TourID == filterParams.TourID) &&
                        (!filterParams.MinRating.HasValue || trip.Tour.ReviewSummary.AverageStars >= filterParams.MinRating) &&
                        (string.IsNullOrWhiteSpace(filterParams.Keyword) || Fuzz.PartialTokenSetRatio(trip.Tour.Title, filterParams.Keyword) >= 50 || Fuzz.PartialTokenSetRatio(trip.Tour.Description, filterParams.Keyword) >= 50) &&
                        (filterParams.TourType == null || trip.Tour.Type == filterParams.TourType) &&
                        (filterParams.Starts == null || trip.StartTime.Date == filterParams.Starts.Value.Date) &&
                        (filterParams.Ends == null || trip.EndTime.Date == filterParams.Ends.Value.Date) &&
                        (filterParams.MinPrice == null || trip.GetSalePrice() >= filterParams.MinPrice) &&
                        (filterParams.MaxPrice == null || trip.GetSalePrice() <= filterParams.MaxPrice))
            .OrderBy(trip => string.IsNullOrEmpty(filterParams.Keyword) ? 0: -Fuzz.PartialTokenSetRatio(trip.Tour.Title, filterParams.Keyword) * 1.5 - Fuzz.PartialTokenSetRatio(trip.Tour.Description, filterParams.Keyword)));
 }
        public List <SheetSoulbreaks> GetAllSoulbreaksByCharacterName(string name)
        {
            var charNames = dbContext.Characters.Select(x => x.Name.ToLower());

            name = aliases.ResolveAlias(name);

            if (!charNames.Contains(name.ToLower()))
            {
                name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
            }

            var soulbreaks = dbContext.Soulbreaks.Where(x => x.Character.ToLower() == name.ToLower() && x.Tier != "RW").ToList();

            return(soulbreaks);
        }
Esempio n. 25
0
        public SheetAbilities GetAbilityByName(string name)
        {
            if (aliases.AliasList.ContainsKey(name.ToLower()))
            {
                name = aliases.AliasList[name.ToLower()];
            }

            var ability = dbContext.Abilities.FirstOrDefault(x => x.Name.ToLower() == name.ToLower() || x.JPName == name || x.ID == name);

            if (ability == null)
            {
                ability = dbContext.Abilities.OrderByDescending(x => Fuzz.PartialRatio(x.Name.ToLower(), name.ToLower())).FirstOrDefault();
            }

            return(ability);
        }
        public SheetLegendSpheres GetCharacterLegendSpereByName(string name, bool exact = false)
        {
            if (aliases.AliasList.ContainsKey(name.ToLower()))
            {
                name = aliases.AliasList[name.ToLower()];
            }

            var legendSphere = dbContext.LegendSpheres.FirstOrDefault(x => x.Character.ToLower() == name.ToLower());

            if (legendSphere == null && !exact)
            {
                legendSphere = dbContext.LegendSpheres.OrderByDescending(x => Fuzz.PartialRatio(x.Character.ToLower(), name.ToLower())).FirstOrDefault();
            }

            return(legendSphere);
        }
Esempio n. 27
0
        public SheetLegendSpheres GetLegendDiveByCharacterName(string name)
        {
            var charNames = dbContext.Characters.Select(x => x.Name.ToLower());

            if (aliases.AliasList.ContainsKey(name.ToLower()))
            {
                name = aliases.AliasList[name.ToLower()];
            }
            else if (!charNames.Contains(name.ToLower()))
            {
                name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
            }

            var legendDive = dbContext.LegendSpheres.FirstOrDefault(x => x.Character.ToLower() == name.ToLower());

            return(legendDive);
        }
Esempio n. 28
0
        public static void searchPkgList(string searchQuery)
        {
            var client = new WebClient();

            Console.WriteLine("\n-- Updating packagelist...");
            client.DownloadFile("https://hexpm-installer-script-mirrors.crazywillbear.repl.co/packagelist.txt", @"C:\Users\" + Environment.UserName + @"\AppData\Roaming\HexPM\packagelist.txt");
            Console.WriteLine("     (Updated packagelist)");
            Console.WriteLine("-- Searching packagelist for: " + searchQuery);
            string[] text = File.ReadAllLines(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\HexPM\packagelist.txt");
            for (int i = 0; i < text.Length; i++)
            {
                if (Fuzz.Ratio(searchQuery.ToLower(), text[i].Split(';')[0].ToLower()) >= 65)
                {
                    Console.WriteLine("     (Found: " + text[i].Split(';')[0] + ")");
                }
            }
        }
Esempio n. 29
0
        public List <SheetAbilities> GetHeroAbilityByCharacterName(string name)
        {
            var charNames = dbContext.Characters.Select(x => x.Name.ToLower());

            if (aliases.AliasList.ContainsKey(name.ToLower()))
            {
                name = aliases.AliasList[name.ToLower()];
            }
            else if (!charNames.Contains(name.ToLower()))
            {
                name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
            }

            var ability = dbContext.Abilities.Where(x => x.Name.ToLower().Contains($"({name.ToLower()} only)")).ToList();

            return(ability);
        }
Esempio n. 30
0
        public SheetRecordBoards GetRecordBoardByCharacterName(string name)
        {
            var charNames = dbContext.Characters.Select(x => x.Name.ToLower());

            if (aliases.AliasList.ContainsKey(name.ToLower()))
            {
                name = aliases.AliasList[name.ToLower()];
            }
            else if (!charNames.Contains(name.ToLower()))
            {
                name = charNames.OrderByDescending(x => Fuzz.PartialRatio(x, name.ToLower())).FirstOrDefault();
            }

            var recordBoards = dbContext.RecordBoards.FirstOrDefault(x => x.Character.ToLower() == name.ToLower());

            return(recordBoards);
        }