コード例 #1
0
        public async Task TextMatchAsync(TextMatchBankStatement3Command command, ITextClassifier matcher)
        {
            var unmatched = State.PredictionResults.Where(x => x.PredictedValue == SubCategories.Uncategorised).ToArray();

            Trace.WriteLine($"{Id} unmatched {unmatched.Count()}");

            var matched = new List <KeyValuePair <PredictionResult, TextClassificationResult> >();

            foreach (var item in unmatched)
            {
                item.Method = PredictionMethod.KeywordMatch;
                var result = await matcher.Match(item.Request.Description);

                if (result.Classifier != null && result.Classifier.SubCategory != SubCategories.Uncategorised)
                {
                    matched.Add(new KeyValuePair <PredictionResult, TextClassificationResult>(item, result));
                }
            }

            Trace.WriteLine($"{Id} matched {matched.Count()}");
            var ev = new BankStatementTextMatched3Event
            {
                Unmatched = unmatched,
                Matched   = matched
            };

            Emit(ev);

            await Task.CompletedTask;
        }
コード例 #2
0
ファイル: BankStatementState.cs プロジェクト: lulzzz/vita
 public void Apply(BankStatementTextMatched3Event aggregateEvent)
 {
     Matched   = aggregateEvent.Matched;
     Unmatched = aggregateEvent.Unmatched;
 }