public SparseMatcher(ISparseDistance distance, IReworder reworder, IReader reader, ITokenizer tokenizer, string encyclopediaFilePath)
 {
     _distance = distance;
     _reader = reader;
     _reworder = reworder;
     _tokenizer = tokenizer;
     _encyclopediaFilePath = encyclopediaFilePath;
 }
Example #2
0
        public static void MetricRun(IReworder reworder, IReader reader, ITokenizer tok, ISparseDistance dist, int nbNeighbours, bool train, bool proba, string questionFilePath, string encyclopediaFilePath, string outFolder)
        {
            string encyclopediaName = Path.GetFileNameWithoutExtension(encyclopediaFilePath);

            string summary = "Metric_" + reworder.GetType().Name + "_" +
                reader.GetType().Name + "_" + tok.GetType().Name + "_" + dist.GetType().Name + "_" + nbNeighbours.ToString() + "_" + encyclopediaName;
            Console.Write("\n" + summary);

            SparseMatcher robot = new SparseMatcher(dist, reworder, reader, tok, encyclopediaFilePath);
            string[] answers = robot.Answer(nbNeighbours, questionFilePath, train, proba);

            if (train)
            {
                EvaluateAndPrintScores(questionFilePath, answers);
            }
            else
            {
                string[] ids = TextToData.ImportColumn(questionFilePath, 0);
                Submissions.Write(answers, ids, outFolder + summary + ".csv");
            }

            Console.WriteLine();
        }