Skip to main content

Out of curiosity a port of love letter generator in c#

This is for my Harley-Queen(still waiting): this is a cook up code to tinker around:
 
using System;
using System.Text;
 
namespace LoveLetter
{
    internal class Program
    {
  static string NextRandomWord(string[] arr, Random rand) => arr[rand.Next(0, arr.Length)];
 
        private static void Main()
        {
            var salutation1 = new string[] { "Beloved""Darling""Dear",
          "Dearest""Fanciful""Honey" };
            var salutation2 = new string[] { "Chickpea""Dear",
                      "Duck""Jewel""Love""Moppet""Sweetheart" };
            var adjs = new string[] { "affectionate""amorous""anxious",
            "avid""beautiful""breathless""burning",
            "covetous""craving""curious""eager""fervent",
             "fondest""loveable""lovesick""loving""passionate",
           "precious""seductive""sweet""sympathetic""tender",
            "unsatisfied""winning""wistful" };
            var nouns = new string[] { "adoration""affection""ambition",
          "appetite""ardour""being""burning""charm""craving",
           "desire""devotion""eagerness""enchantment""enthusiasm",
        "fancy""fellow feeling""fervour""fondness""heart""hunger",
            "infatuation""little liking""longing""love""lust",
          "passion""rapture""sympathy""thirst""wish""yearning" };
            var advs = new string[] { "affectionately""ardently""anxiously",
             "beautifully""burningly""covetously""curiously",
        "eagerly""fervently""fondly""impatiently""keenly",
            "lovingly""passionately""seductively",
       "tenderly""wistfully" };
            var verbs = new string[] { "adores""attracts""clings to",
             "holds dear""hopes for""hungers for""likes",
       "longs for""loves""lusts after""pants for""pines for",
             "sighs for""tempts""thirsts for",
         "treasures""yearns for""woos" };
 
            int LONG = 1;
            int SHORT = 2;
            int? last = null;
            var rand = new Random();
            string ll;
            string concat = "";
            var builder = new StringBuilder();
            builder.Append($"{NextRandomWord(salutation1, rand)} 
                           { NextRandomWord(salutation2, rand)} \n");
            int numberOfLines = rand.Next(57);
            for (var i = 0; i < numberOfLines; i++)
            {
                if (rand.Next(09< 5)
                {
                    //LONG
                    var optadj1 = (rand.Next(09< 5? "" : NextRandomWord(adjs, rand);
                    var noun1 = NextRandomWord(nouns, rand);
                    var optadv = (rand.Next(09< 5? "" : NextRandomWord(advs, rand);
                    var verb = NextRandomWord(verbs, rand);
                    var optadj2 = (rand.Next(09< 5? "" : NextRandomWord(adjs, rand);
                    var noun2 = NextRandomWord(nouns, rand);
                    if (last != null || last == LONG)
                    {
                        concat = ". ";
                    }
                    builder.Append($"{concat} My {optadj1} {noun1} {optadv} {verb} your 
                                     { optadj2}
                    { noun2}
                    ");
                    last = LONG;
                }
                else
                {
                    //SHORT
                    var adj = NextRandomWord(adjs, rand);
                    var noun = NextRandomWord(nouns, rand);
                    if (last == SHORT)
                    {
                        concat = ", ";
                    }
                    else if (last == LONG)
                    {
                        concat = ". You are";
                    }
                    else
                    {
                        concat = "You are ";
                    }
                    builder.Append($"{concat} my {adj} {noun}");
                    last = SHORT;
                }
            }
            ll = builder.ToString();
            var adv = NextRandomWord(advs, rand);
            ll += string.Format(".\n     Yours {0},\n     {1}.\n", adv, "Yourname");
            Console.WriteLine(ll);
            Console.ReadKey();
        }
    }
}

Comments

Popular posts from this blog

Start

Welcome to GeekyJackie  well this is my technical blog where I intend to showcase my Technical Ideas, project etc.... And its Day One.  A Little About My self will do great right ? Myself JazeemAzeez  AKA Jackie. Well Right now im a Student doing Post-graduation in CSE(Computer Science and Engineering ) @ Hindustan University Chennai. I feel Sometimes a little Geeky/Nerdy. This is my final year of PG right now doing . About the project  A long story in short.During PG we students can choose our project under the domain which we like to specialize. so Initially i Had Chosen Network security Domain & Later on due to Circumstances I Had been re allocated to Specialize in Data Mining & Far most Shocking was that I had Go a Guide Who is know for his perfectionism. Data Mining is a field or paper which I really intended to avoid. My previous Guide Motivated me to do it, I had started searching for a Topic. basically it was ...
Going OpenSource ... Recently I have been thinking, I have finished several projects , but whats my contribution to the public cuz most of  the works have been for clients... So gonna start uploading some of the nightly builds over there

Working With Kerala Police ;State Crime Records Bureau

Thanks to Mr. Habeeb Khan - Last few days i have been working with KSPD(Kerala State police department)  for my project .I should thank to my brother for helping me to get over there : he Introduced me to SP Jayakumar . who is the Cheif over there. things got moved swiftly. Got an Insight view about how things are beign done . I Also found that Crime Bureau in India have a Special wing which perform the near similar tasks of my project but of-course offline and manual . well its a good bussiness idea 3:) Update  Today my web-crawler have been built and its being tested to incorporate LDA algorithm for topic detection which i belive will give me relavent pages of interest My deadl line is 19th of this month : And IM running Really short in time : datacollection part is really getting tough as , the department will most probably hand over me with hard copy of data