Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine(Properties.Resources.Instructions.Replace(@"\n", Environment.NewLine));
                PressAnyKey();
                return;
            }
            else
            {
                string serialNumber = args[0];

                // Try to parse
                try
                {
                    dynamic trademarkFile = JsonConvert.DeserializeObject(DAO.TsdrDAO.GetApplicationData(serialNumber));

                    Casefile casefile = Services.Parser.TrademarkFileToCasefile(trademarkFile);

                    // Make prediction
                    MLContext    mlContext  = new MLContext();
                    ITransformer model      = GetModel(mlContext, "ML" + Path.DirectorySeparatorChar + AllApplicationsModel);
                    var          prediction = Predict(mlContext, model, casefile);

                    // Output results
                    ShowPrediction(prediction);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error parsing data: " + ex.Message);
                }
            }
        }
Пример #2
0
        public static Casefile TrademarkFileToCasefile(dynamic trademarkFile)
        {
            string markLiteralElements = trademarkFile.trademarks[0].status.markElement;
            int    ownerTypeId         = trademarkFile.trademarks[0].parties.ownerGroups["10"][0].entityType.code;
            string attorney            = trademarkFile.trademarks[0].status.correspondence.attorneyName;

            string     allGoodsAndServices = string.Empty;
            List <int> classIds            = new List <int>();

            IEnumerable <object> gsList = trademarkFile.trademarks[0].gsList;

            foreach (dynamic d in gsList)
            {
                allGoodsAndServices += d.description;
                classIds.Add((int)d.internationalClasses[0].code);
            }

            Casefile casefile = new Casefile(markLiteralElements,
                                             ownerTypeId,
                                             classIds.Count,
                                             allGoodsAndServices,
                                             attorney,
                                             ClassIdListToBoolArray(classIds),
                                             false);

            return(casefile);
        }
Пример #3
0
        private static bool Predict(MLContext mlContext, ITransformer model, Casefile casefile)
        {
            PredictionEngine <Casefile, CasefilePrediction> predictionFunction = mlContext.Model.CreatePredictionEngine <Casefile, CasefilePrediction>(model);

            var resultPrediction = predictionFunction.Predict(casefile);

            return(resultPrediction.Prediction);
        }
Пример #4
0
            public async Task <int> Handle(CreateCasefileCommand command, CancellationToken cancelToken)
            {
                var casefile = new Casefile
                {
                    PatientId = command.PatientId,
                    Name      = command.Name,
                    Created   = DateTime.UtcNow
                };

                _dbContext.Casefiles.Add(casefile);
                await _dbContext.SaveChangesAsync(cancelToken);

                return(casefile.Id);
            }