Ejemplo n.º 1
0
    public void MarkovChainTest()
    {
        string text = "I am silently ignoring bad ids because they are entered by content editors who want to pull in certain images on to their pages, however I can put validation on the field to stop that from happening I suppose";

        Markov.MarkovChain markov = new Markov.MarkovChain();
        markov.Load(text);

        Debug.Log (markov.Output ());
    }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string content = "";
            List<int> indexs = new List<int>();
            int lastIndex = -1;
            Random ran = new Random();

            while (true)
            {
                int index = ran.Next(0, 2200);
                if (index != lastIndex)
                {
                    indexs.Add(index);
                    lastIndex = index;
                }

                if (indexs.Count > 20)
                    break;
            }

            content = GetTweets.GetFromDB(indexs);
            MarkovChain mc = new MarkovChain();
            mc.Load(content);
            string output = "";
            while (true)
            {
                output = mc.Output();

                if (output.Length < 140)
                    break;
            }

            var service = new TwitterService(ConfigurationManager.AppSettings["ConsumerKey"], ConfigurationManager.AppSettings["ConsumerKeySecret"]);
            service.AuthenticateWith(ConfigurationManager.AppSettings["AccessToken"], ConfigurationManager.AppSettings["AccessTokenSecret"]);
            service.SendTweet(output);
        }
Ejemplo n.º 3
0
 void Start()
 {
     markov = new MarkovChain();
     markov.Load(text);
 }