private void handle(RetrieveDocumentResultMessage message) { var foodNameQuery = message.Request.FoodNameQuery; var foodNameTerms = new FoodNameTerms(foodNameQuery); Self.Tell(new ScoreDocumentRequestMessage(message.SearchResultDoc, foodNameTerms, foodNameTerms)); foreach (var foodName in _foodNames.Where(n => !n.Equals(foodNameQuery))) { Self.Tell(new ScoreDocumentRequestMessage(message.SearchResultDoc, new FoodNameTerms(foodName), foodNameTerms)); } }
public DocumentScore(SearchResultDocument document, FoodNameTerms terms, FoodNameScoreVector foodNameScoreVector) { if (document == null) { throw new ArgumentNullException(nameof(document)); } if (terms == null) { throw new ArgumentNullException(nameof(terms)); } if (foodNameScoreVector == null) { throw new ArgumentNullException(nameof(foodNameScoreVector)); } Document = document; FoodNameTerms = terms; ScoreVector = foodNameScoreVector; }
public ScoreDocumentRequestMessage(SearchResultDocument document, FoodNameTerms foodNameTerms, FoodNameTerms sourceFoodTerms) { if (document == null) { throw new ArgumentNullException(nameof(document)); } if (foodNameTerms == null) { throw new ArgumentNullException(nameof(foodNameTerms)); } if (sourceFoodTerms == null) { throw new ArgumentNullException(nameof(sourceFoodTerms)); } Document = document; FoodNameTerms = foodNameTerms; SourceFoodTerms = sourceFoodTerms; }
private DocumentScore scoreDocumentForTermsAsync(SearchResultDocument document, FoodNameTerms terms) { var documentVector = document.DocumentVector; var score = new Double[documentVector.Length]; for (var i = 0; i < documentVector.Length; i++) { if (terms.Contains(documentVector[i])) { score[i] = 1.0; } } return(new DocumentScore(document, terms, new FoodNameScoreVector(score))); }
public DebugProxy(FoodNameTerms instance) { Debug.Assert(instance != null); _instance = instance; }