public SearchEngine(SearchEngineConfig config) { mConfig = config; mQueryParser = new SimpleQueryParser(new QueryParserConfig { TextSegmenter = config.TextSegmenter, }); mRetriever = new InexactTopKRetriever(new RetrieverConfig { PostingListStore = config.PostingListStore, UrlFileStore = config.UrlFileStore, InvertedIndexStore = config.InvertedIndexStore, }, ResultSize); var rankerConfig = new RankerConfig { PostingListStore = config.PostingListStore, UrlFileStore = config.UrlFileStore, InvertedIndexStore = config.InvertedIndexStore, }; mRanker = new IntegratedRanker(rankerConfig); mProRanker = new QueryTermProximityRanker(rankerConfig); mLogger = new RuntimeLogger(Path.Combine(config.LogDirectory, "SearchEngine.Log"), true); }
public int[] ChooseRanking(string uniqueKey, TContext context, IRanker <TContext> defaultRanker) { return(this.ChooseRankingAsync(uniqueKey, context, defaultRanker) .ConfigureAwait(true) .GetAwaiter() .GetResult()); }
/// <summary> /// Performs ranking using the specified algorithm /// </summary> /// <param name="rankingAlgorithm">The algorithm that should be used for ranking</param> public void PerformRanking(IRanker rankingAlgorithm) { RankerBase ranker = rankingAlgorithm as RankerBase; // Validate the provided ranker if (ranker == null) { throw new ArgumentNullException("rankingAlgorithm", "No valid ranker provided"); } // Execute the ranking algorithm. If normalizeResults is true then // the returned results are normalized rather than just the raw values. ranker.CalculateNormalizedRankAsync(GraphManager.Instance.DefaultGraphComponentsInstance.Scope); }
// Call Rank() on the given IRanker then transform its result into a message which is // informative to the end user. public static (string strong, string normal) RankAndHumanify(IRanker ranker, string query) { string rankings; try { rankings = ranker.Rank(query, TARGET_SITE); } catch (ExtractionException ex) { return("Error: ", ex.Message); } if (rankings == "0") { return("Result: ", $"The site '{TARGET_SITE}' could not be found in the search results."); } string inflected_index = rankings.Split(' ').Length == 1 ? "index" : "indices"; return("Result: ", $"The site '{TARGET_SITE}' was found at the following {inflected_index} (where 1 represents the first search result): {rankings}."); }
public Scorer(IRanker ranker) { _ranker = ranker; }
public async Task <int[]> ChooseRankingAsync(string uniqueKey, TContext context, IRanker <TContext> defaultRanker, bool doNotLog) { return(await ChooseRankingAsync(uniqueKey, context, (await defaultRanker.MapContextAsync(context)).Value, doNotLog)); }
public Task <int[]> ChooseRankingAsync(string uniqueKey, TContext context, IRanker <TContext> defaultRanker) { return(this.ChooseRankingAsync(uniqueKey, context, defaultRanker, doNotLog: false)); }
public HomeController(ILogger <HomeController> log, IRanker ranker) { this.log = log; this.ranker = ranker; }
public RankerTests(SystemUnderTestFixture <Ranker> fixture) { _ranker = fixture.SystemUnderTest; }
public SearchService(IUnitOfWork uow, IListingService listingService, IRanker ranker) { this.uow = uow; this.listingService = listingService; this.ranker = ranker; }
public static void TheHandIsRanked(IRanker ranker, string handNotation, out Hand hand) { hand = new Hand(handNotation); ranker.RankHand(hand); }
public int[] ChooseRanking(string uniqueKey, TContext context, IRanker <TContext> defaultRanker, bool doNotLog) { return(ChooseRanking(uniqueKey, context, defaultRanker.MapContext(context).Value, doNotLog)); }
/// <summary> /// Performs ranking using the specified algorithm /// </summary> /// <param name="rankingAlgorithm">The algorithm that should be used for ranking</param> public void PerformRanking(IRanker rankingAlgorithm) { RankerBase ranker = rankingAlgorithm as RankerBase; // Validate the provided ranker if (ranker == null) throw new ArgumentNullException("rankingAlgorithm", "No valid ranker provided"); // Execute the ranking algorithm. If normalizeResults is true then // the returned results are normalized rather than just the raw values. ranker.CalculateNormalizedRankAsync(GraphManager.Instance.DefaultGraphComponentsInstance.Scope); }