Beispiel #1
0
        public static CrowdproofData getCannedData()
        {
            // insert text
            Globals.Soylent.Application.Selection.Range.InsertAfter("However, while GUIs made using computers be more intuitive and easier to learn, it didn't let people be able to control computers efficiently.  Masses only can use the software developed by software companies, unless they know how to write programs.  In other words, if one who knows nothing about programming needs to click through 100 buttons to complete her job everyday, the only thing she can do is simply to click through those buttons by hand every time.  But if she happens to be a computer programmer, there is a little chance that she can write a program to automate everything.  Why is there only a little chance?  In fact, each GUI application is a big black box, which usually have no outward interfaces for connecting to other programs.  In other words, this truth builds a great wall between each GUI application so that people have difficulty in using computers efficiently.  People still do much tedious and repetitive work in front of a computer.");
            // select it
            Word.Range canned_range = Globals.Soylent.Application.ActiveDocument.Paragraphs[1].Range;

            List <CrowdproofPatch> patches = new List <CrowdproofPatch>();

            string[] onesToFind = { "GUIs made using computers be more intuitive and easier to learn", "let people be able to control", "Masses only can" };
            foreach (Word.Range r in canned_range.Sentences)
            {
                foreach (string oneToFind in onesToFind)
                {
                    if (r.Text.Contains(oneToFind))
                    {
                        object     start    = r.Text.IndexOf(oneToFind) + r.Start;
                        object     end      = (int)start + oneToFind.Length;
                        Word.Range newRange = Globals.Soylent.Application.ActiveDocument.Range(ref start, ref end);

                        List <string> replacements = new List <string>();
                        List <string> explanations = new List <string>();

                        if (oneToFind == onesToFind[0])
                        {
                            replacements.Add("GUIs made using computers more intuitive and easier to learn");

                            explanations.Add("The word \"be\" is incorrectly inserted.");
                            explanations.Add("style issues");
                        }
                        else if (oneToFind == onesToFind[1])
                        {
                            replacements.Add("allow people to control");

                            explanations.Add("'Be able to' is unnecessary.");
                            explanations.Add("awkward construction");
                        }
                        else if (oneToFind == onesToFind[2])
                        {
                            replacements.Add("The masses can only");
                            replacements.Add("The majority of people only can");

                            explanations.Add("'Only can' should be switched around to 'can only'");
                            explanations.Add("Masses is not a proper name and should have \"The\" in front of it. Only in front of can is too choppy.");
                            explanations.Add("Bad word usage");
                        }

                        CrowdproofPatch patch = new CrowdproofPatch(newRange, replacements, explanations);
                        patches.Add(patch);
                    }
                }
            }

            CrowdproofData pd = new CrowdproofData(canned_range, Globals.Soylent.jobManager.generateJobNumber());

            pd.patches = patches;
            return(pd);
        }
Beispiel #2
0
        /// <summary>
        /// This constructor used only when recreating a job from XML saved with a document
        /// </summary>
        /// <param name="data"></param>
        /// <param name="jobNumber"></param>
        public CrowdproofJob(CrowdproofData data, int jobNumber, bool startTurk)
        {
            this.data = data;
            this.jobNumber = jobNumber;

            CrowdproofView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber) as CrowdproofView;
            hit.addStage(1, HITData.ResultType.Find, data.findStageData, "Identify Errors", 10, 0.10, jobNumber);
            hit.addStage(2, HITData.ResultType.Fix, data.fixStageData, "Fix Errors", 5, 0.05, jobNumber);
            hit.addStage(3, HITData.ResultType.Verify, data.verifyStageData, "Quality Control", 5, 0.05, jobNumber);

            if (startTurk)
            {
                data.startTask();
            }
        }
Beispiel #3
0
        /// <summary>
        /// The Model for a Crowdproof job.  This creates the View elements for this task
        /// </summary>
        /// <param name="data">The CrowdproofData instance for this job</param>
        /// <param name="jobNumber">The unique job number</param>
        public CrowdproofJob(int jobNumber, Word.Range range)
        {
            //this.data = data;
            this.jobNumber = jobNumber;

            Globals.Soylent.jobToDoc[jobNumber] = Globals.Soylent.Application.ActiveDocument;

            this.data = new CrowdproofData(range, jobNumber);

            CrowdproofView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber) as CrowdproofView;
            hit.addStage(1, HITData.ResultType.Find, data.findStageData, "Identify Errors", 10, 0.10, jobNumber);
            hit.addStage(2, HITData.ResultType.Fix, data.fixStageData, "Fix Errors", 5, 0.05, jobNumber);
            hit.addStage(3, HITData.ResultType.Verify, data.verifyStageData, "Quality Control", 5, 0.05, jobNumber);

            data.startTask();
        }
Beispiel #4
0
        /// <summary>
        /// This constructor used only when recreating a job from XML saved with a document
        /// </summary>
        /// <param name="data"></param>
        /// <param name="jobNumber"></param>
        public CrowdproofJob(CrowdproofData data, int jobNumber, bool startTurk)
        {
            this.data      = data;
            this.jobNumber = jobNumber;

            CrowdproofView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber) as CrowdproofView;

            hit.addStage(1, HITData.ResultType.Find, data.findStageData, "Identify Errors", 10, 0.10, jobNumber);
            hit.addStage(2, HITData.ResultType.Fix, data.fixStageData, "Fix Errors", 5, 0.05, jobNumber);
            hit.addStage(3, HITData.ResultType.Verify, data.verifyStageData, "Quality Control", 5, 0.05, jobNumber);

            if (startTurk)
            {
                data.startTask();
            }
        }
Beispiel #5
0
        /// <summary>
        /// The Model for a Crowdproof job.  This creates the View elements for this task
        /// </summary>
        /// <param name="data">The CrowdproofData instance for this job</param>
        /// <param name="jobNumber">The unique job number</param>
        public CrowdproofJob(int jobNumber, Word.Range range)
        {
            //this.data = data;
            this.jobNumber = jobNumber;

            Globals.Soylent.jobToDoc[jobNumber] = Globals.Soylent.Application.ActiveDocument;

            this.data = new CrowdproofData(range, jobNumber);

            CrowdproofView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber) as CrowdproofView;

            hit.addStage(1, HITData.ResultType.Find, data.findStageData, "Identify Errors", 10, 0.10, jobNumber);
            hit.addStage(2, HITData.ResultType.Fix, data.fixStageData, "Fix Errors", 5, 0.05, jobNumber);
            hit.addStage(3, HITData.ResultType.Verify, data.verifyStageData, "Quality Control", 5, 0.05, jobNumber);

            data.startTask();
        }
Beispiel #6
0
        /// <summary>
        /// HITView subclass specific to Shortn tasks.  This adds the Shortn button and additional necessary functionality.
        /// </summary>
        /// <param name="workType"></param>
        /// <param name="data"></param>
        public CrowdproofView(string workType, CrowdproofData data, int job)
            : base(workType, data, job)
        {
            //Globals.Soylent.soylent.Controls.Add(new System.Windows.Forms.Button());
            CrowdproofButton = new Button();
            CrowdproofButton.Content = "View Revisions";
            CrowdproofButton.Name = "Crowdproof";
            CrowdproofButton.Height = 23;
            //CrowdproofButton.Width = 90;
            CrowdproofButton.IsEnabled = false;
            CrowdproofButton.Click += new RoutedEventHandler(Crowdproof_Clicked);

            AcceptRevisions = new Button();
            AcceptRevisions.Content = "Accept All";
            AcceptRevisions.Name = "AcceptRevisions";
            AcceptRevisions.Height = 23;
            AcceptRevisions.Width = 100;
            AcceptRevisions.IsEnabled = false;
            AcceptRevisions.Click += new RoutedEventHandler(AcceptRevisions_Clicked);

            RejectRevisions = new Button();
            RejectRevisions.Content = "Reject All";
            RejectRevisions.Name = "RejectRevisions";
            RejectRevisions.Height = 23;
            RejectRevisions.Width = 100;
            RejectRevisions.IsEnabled = false;
            RejectRevisions.Click += new RoutedEventHandler(RejectRevisions_Clicked);

            buttons = new StackPanel();
            buttons.Orientation = System.Windows.Controls.Orientation.Horizontal;
            buttons.Children.Add(AcceptRevisions);
            buttons.Children.Add(RejectRevisions);

            stages.Children.Add(CrowdproofButton);
            stages.Children.Add(buttons);

            this.data = data;
            data.register(this);

            jobTurkerName = turkerName + job;
        }
Beispiel #7
0
        public static CrowdproofData getCannedData()
        {
            // insert text
            Globals.Soylent.Application.Selection.Range.InsertAfter("However, while GUIs made using computers be more intuitive and easier to learn, it didn't let people be able to control computers efficiently.  Masses only can use the software developed by software companies, unless they know how to write programs.  In other words, if one who knows nothing about programming needs to click through 100 buttons to complete her job everyday, the only thing she can do is simply to click through those buttons by hand every time.  But if she happens to be a computer programmer, there is a little chance that she can write a program to automate everything.  Why is there only a little chance?  In fact, each GUI application is a big black box, which usually have no outward interfaces for connecting to other programs.  In other words, this truth builds a great wall between each GUI application so that people have difficulty in using computers efficiently.  People still do much tedious and repetitive work in front of a computer.");
            // select it
            Word.Range canned_range = Globals.Soylent.Application.ActiveDocument.Paragraphs[1].Range;

            List<CrowdproofPatch> patches = new List<CrowdproofPatch>();

            string[] onesToFind = {"GUIs made using computers be more intuitive and easier to learn", "let people be able to control", "Masses only can"};
            foreach (Word.Range r in canned_range.Sentences)
            {
                foreach(string oneToFind in onesToFind) {
                    if (r.Text.Contains(oneToFind)) {
                        object start = r.Text.IndexOf(oneToFind) + r.Start;
                        object end = (int) start + oneToFind.Length;
                        Word.Range newRange = Globals.Soylent.Application.ActiveDocument.Range(ref start, ref end);

                        List<string> replacements = new List<string>();
                        List<string> explanations = new List<string>();

                        if (oneToFind == onesToFind[0])
                        {
                            replacements.Add("GUIs made using computers more intuitive and easier to learn");

                            explanations.Add("The word \"be\" is incorrectly inserted.");
                            explanations.Add("style issues");
                        }
                        else if (oneToFind == onesToFind[1])
                        {
                            replacements.Add("allow people to control");

                            explanations.Add("'Be able to' is unnecessary.");
                            explanations.Add("awkward construction");
                        }
                        else if (oneToFind == onesToFind[2])
                        {
                            replacements.Add("The masses can only");
                            replacements.Add("The majority of people only can");

                            explanations.Add("'Only can' should be switched around to 'can only'");
                            explanations.Add("Masses is not a proper name and should have \"The\" in front of it. Only in front of can is too choppy.");
                            explanations.Add("Bad word usage");
                        }

                        CrowdproofPatch patch = new CrowdproofPatch(newRange, replacements, explanations);
                        patches.Add(patch);
                    }
                }
            }

            CrowdproofData pd = new CrowdproofData(canned_range, Globals.Soylent.jobManager.generateJobNumber());
            pd.patches = patches;
            return pd;
        }
Beispiel #8
0
        /// <summary>
        /// Open the Shortn dialog window.  Used internally after the Shortn button is pressed, and by Ribbon for the debugging
        /// </summary>
        /// <param name="data"></param>
        public void insertTrackChanges(CrowdproofData data)
        {
            Globals.Soylent.Application.ActiveDocument.TrackRevisions = true;
            Globals.Soylent.Application.ActiveDocument.ShowRevisions = true;

            Microsoft.Office.Core.DocumentProperties properties;

            properties = (Microsoft.Office.Core.DocumentProperties) Globals.Soylent.Application.ActiveDocument.BuiltInDocumentProperties;
            string defaultAuthor = properties["Author"].Value as string;
            if (defaultAuthor == turkerName)
            {
                turkerName = turkerName + "B";
            }

            foreach (CrowdproofPatch patch in data.patches)
            {
                string comment = "";
                foreach (string reason in patch.reasons)
                {
                    if (patch.reasons.IndexOf(reason) == 0)
                    {
                        comment += reason;

                    }
                    else if (patch.reasons.IndexOf(reason) == 1)
                    {
                        comment += "\n\nOther Explanations:";
                        comment += "\n - ";
                        comment += reason;
                    }
                    else
                    {
                        comment += "\n - ";
                        comment += reason;
                    }
                }
                foreach (string suggestion in patch.replacements)
                {
                    if (patch.replacements.IndexOf(suggestion) == 0)
                    {
                        if (patch.replacements.Count > 1)
                        {
                            comment += "\n\nOther Suggestions:";
                        }
                    }
                    else
                    {
                        comment += "\n - ";
                        comment += suggestion;
                    }
                }
                object commentText = comment;
                Microsoft.Office.Interop.Word.Comment c = Globals.Soylent.Application.ActiveDocument.Comments.Add(patch.range, commentText);
                c.Author = jobTurkerName;

                Globals.Soylent.Application.UserName = jobTurkerName;
                patch.range.Text = patch.replacements[0];
                Globals.Soylent.Application.UserName = defaultAuthor;

            }

            /*
            foreach (Microsoft.Office.Interop.Word.Comment c in Globals.Soylent.Application.ActiveDocument.Comments)
            {
                c.Author = jobTurkerName;
                c.Initial = jobTurkerName;
            }
            */

            //this.AcceptRevisions.IsEnabled = true;
            //this.stages.Children.Remove(CrowdproofButton);
            //this.stages.Children.Add(buttons);
            AcceptRevisions.IsEnabled = true;
            RejectRevisions.IsEnabled = true;
            CrowdproofButton.IsEnabled = false;

            stub.AcceptRevisions.IsEnabled = true;
            stub.RejectRevisions.IsEnabled = true;
            stub.CrowdproofButton.IsEnabled = false;

            Globals.Soylent.Application.ActiveDocument.TrackRevisions = false;
        }