Search code examples
.nethumanizer

Humanizr.net ignore word/acronym


I am looping through a collection of strings and using Humanizr.net.

This is so that I can correct each string to sentence case.

For example.

        List<string> mystrings = new List<string>();
        mystrings.Add("my string one");
        mystrings.Add("my string two aBC");
        mystrings.Add("My String Three");

        foreach (string x in mystrings)
        {
            Console.WriteLine(x.Humanize());
        }

The output I am getting is this

        //what i am getting
        //----------------------
        //My string one
        //My string two a BC
        //My string three

I am wondering is it possible to add exclusions or words to ignore so that I get this

        //what i want
        //----------------------
        //My string two aBC

Thank You


Solution

  • In lieu of a answer I have come up with the following solution.

    1. Have a data store either Database or a Simple File (this is what i used in my case) that contains a list of know words and acronyms that I don't want Humanizer to convert along with what Humanizer converts it to.

    2. I then do a simple lookup and replace after the Humanizer call.

    While not the most elegant solution it will work in my case for now.