Use heuristic ranker

This commit is contained in:
Daoud Clarke 2022-08-09 22:56:12 +01:00
parent c1b9e70743
commit 3bcb7f42c1

View file

@ -1,13 +1,13 @@
import argparse
import logging
import os
import pickle
import sys
from multiprocessing import Process, Queue
from pathlib import Path
import uvicorn
from fastapi import FastAPI
from mwmbl import background
from mwmbl.crawler import app as crawler
from mwmbl.indexer.batch_cache import BatchCache
@ -15,7 +15,7 @@ from mwmbl.indexer.paths import INDEX_NAME, BATCH_DIR_NAME
from mwmbl.tinysearchengine import search
from mwmbl.tinysearchengine.completer import Completer
from mwmbl.tinysearchengine.indexer import TinyIndex, Document, NUM_PAGES, PAGE_SIZE
from mwmbl.tinysearchengine.ltr_rank import LTRRanker
from mwmbl.tinysearchengine.rank import HeuristicRanker
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
@ -58,9 +58,9 @@ def run():
completer = Completer()
with TinyIndex(item_factory=Document, index_path=index_path) as tiny_index:
# ranker = HeuristicRanker(tiny_index, completer)
model = pickle.load(open(MODEL_PATH, 'rb'))
ranker = LTRRanker(model, tiny_index, completer)
ranker = HeuristicRanker(tiny_index, completer)
# model = pickle.load(open(MODEL_PATH, 'rb'))
# ranker = LTRRanker(model, tiny_index, completer)
# Initialize FastApi instance
app = FastAPI()