Spaces:
Sleeping
Sleeping
Shakshi3104
commited on
Commit
·
83ce2de
1
Parent(s):
133e909
[add] Implement base search client class
Browse files- model/search/base.py +20 -0
model/search/base.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import abc
|
2 |
+
from typing import List, Union
|
3 |
+
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
|
7 |
+
class BaseSearchClient:
|
8 |
+
"""
|
9 |
+
検査インタフェースクラス
|
10 |
+
"""
|
11 |
+
corpus: pd.DataFrame | list | None = None
|
12 |
+
|
13 |
+
@classmethod
|
14 |
+
@abc.abstractmethod
|
15 |
+
def from_dataframe(cls, _data: pd.DataFrame, _target: str):
|
16 |
+
raise NotImplementedError()
|
17 |
+
|
18 |
+
@abc.abstractmethod
|
19 |
+
def search_top_n(self, _query: Union[List[str], str], n: int=10) -> List[pd.DataFrame]:
|
20 |
+
raise NotImplementedError()
|