コード例 #1
0
ファイル: ComparisonModelTest.cs プロジェクト: yas4891/MUTEX
        public void Default()
        {
            var factory = new MutexTokenFactory();
            var model = new ComparisonModel(factory.GetTokenWrapperEnumerable(defaultTokenSet),
                new []{
                        new SourceEntityData("stud1", "assignment1", defaultTokenSet, "bla" ),
                        new SourceEntityData("stud2", "assignment1", new[] {"CASE", "DECREMENT"}, "bla2")
                    }, factory);

            model.Calculate();

            Assert.AreEqual(100, model.MaximumSimilarity);
        }
コード例 #2
0
ファイル: AppLogicImpl.cs プロジェクト: yas4891/MUTEX
        /// <summary>
        /// calculates the maximum similarity of the provided source against
        /// all sources for the given asignment in the reference database
        /// </summary>
        /// <param name="student"></param>
        /// <param name="assignment"></param>
        /// <param name="source"></param>
        public void Start(string student, string assignment, string source)
        {
            cLogger.DebugFormat("starting with threshold {0}", Threshold);
            TokenFactory factory = new MutexTokenFactory();

            var tokens = factory.GetTokenWrapperListFromSource(source);
            //LexerHelper.CreateLexerFromSource(source).GetTokenWrappers().ToList();
            cLogger.Debug("tokenized source... loading Data Repository");
            var repo = Repository.GetRepository();

            comparisonModel = new ComparisonModel(tokens, repo.LoadByAssignment(assignment), factory);

            comparisonModel.Calculate();

            var sourceEntityData = new SourceEntityData(student, assignment, tokens.ToStringEnumerable(), source);

            repo.Store(sourceEntityData, MaximumSimilarity < Threshold);
        }