Ejemplo n.º 1
0
        public void Cannibalize(string str)
        {
            int min = (str.Length / 2) - 1;

            if (min < 3)
            {
                min = 3;
            }

            String start = GetStart(str, min - 1);

            if (start.Trim().Length > 0 && !CommonStartNames.Contains(start))
            {
                CommonStartNames.Add(start);
            }
            String end = GetEnd(str, min);

            if (end.Length > 5)
            {
                String mid = end;
                mid = GetStart(mid, end.Length / 3);
                end = end.Substring(mid.Length);
            }

            if (end.Trim().Length > 0 && !CommonEndNames.Contains(end))
            {
                CommonEndNames.Add(end);
            }
        }
Ejemplo n.º 2
0
        public void ShortenWordCounts()
        {
            int targ    = CommonStartNames.Count / 4;
            int targend = CommonEndNames.Count / 4;

            targ    = Math.Min(20, targ);
            targend = Math.Min(20, targend);

            while (CommonStartNames.Count > targ)
            {
                CommonStartNames.RemoveAt(Rand.Next(CommonStartNames.Count));
            }
            while (CommonEndNames.Count > targend)
            {
                CommonEndNames.RemoveAt(Rand.Next(CommonEndNames.Count));
            }
        }