JackSparrow89 commited on
Commit
64ac601
·
verified ·
1 Parent(s): 8c89281

Update searcher/sparse_retriever.py

Browse files
Files changed (1) hide show
  1. searcher/sparse_retriever.py +4 -1
searcher/sparse_retriever.py CHANGED
@@ -21,10 +21,13 @@ class SparseRetriever:
21
  """
22
 
23
  def __init__(self, config_path="config.yaml"):
 
24
  with open(config_path) as f:
25
  config = yaml.safe_load(f)
26
 
27
- self.data_dir = config["data_dir"]
 
 
28
  self.db_path = f"{self.data_dir}/metadata.db"
29
  self.k1 = 1.5 # term frequency saturation
30
  self.b = 0.75 # length normalisation
 
21
  """
22
 
23
  def __init__(self, config_path="config.yaml"):
24
+ config_path = os.path.abspath(config_path)
25
  with open(config_path) as f:
26
  config = yaml.safe_load(f)
27
 
28
+ config_dir = os.path.dirname(config_path)
29
+ data_dir = config["data_dir"]
30
+ self.data_dir = data_dir if os.path.isabs(data_dir) else os.path.normpath(os.path.join(config_dir, data_dir))
31
  self.db_path = f"{self.data_dir}/metadata.db"
32
  self.k1 = 1.5 # term frequency saturation
33
  self.b = 0.75 # length normalisation