|
@@ -9,6 +9,8 @@ from examples.demand.pattern_builds.pattern_service import run_mining
|
|
|
|
|
|
|
|
db = DatabaseManager()
|
|
db = DatabaseManager()
|
|
|
|
|
|
|
|
|
|
+CHANGWEN_DATA_DIR = Path(__file__).parent / "data" / "changwen_data"
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def _safe_float(value):
|
|
def _safe_float(value):
|
|
|
if value is None:
|
|
if value is None:
|
|
@@ -63,7 +65,7 @@ def _extract_digits(value: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
def _build_score_by_videoid(cluster_name: str):
|
|
def _build_score_by_videoid(cluster_name: str):
|
|
|
- json_path = Path(__file__).parent / f"{cluster_name}.json"
|
|
|
|
|
|
|
+ json_path = CHANGWEN_DATA_DIR / f"{cluster_name}.json"
|
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
|
payload = json.load(f)
|
|
payload = json.load(f)
|
|
|
|
|
|
|
@@ -97,7 +99,7 @@ def filter_low_exposure_records(
|
|
|
过滤 JSON 中推荐曝光数小于阈值的记录,并写回原文件。
|
|
过滤 JSON 中推荐曝光数小于阈值的记录,并写回原文件。
|
|
|
默认过滤阈值: 1000
|
|
默认过滤阈值: 1000
|
|
|
"""
|
|
"""
|
|
|
- json_path = Path(__file__).parent / f"{cluster_name}.json"
|
|
|
|
|
|
|
+ json_path = CHANGWEN_DATA_DIR / f"{cluster_name}.json"
|
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
|
payload = json.load(f)
|
|
payload = json.load(f)
|
|
|
|
|
|
|
@@ -126,7 +128,7 @@ def filter_low_exposure_records(
|
|
|
|
|
|
|
|
|
|
|
|
|
def changwen_data_prepare(cluster_name) -> int:
|
|
def changwen_data_prepare(cluster_name) -> int:
|
|
|
- json_path = Path(__file__).parent / f"{cluster_name}.json"
|
|
|
|
|
|
|
+ json_path = CHANGWEN_DATA_DIR / f"{cluster_name}.json"
|
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
with open(json_path, "r", encoding="utf-8") as f:
|
|
|
payload = json.load(f)
|
|
payload = json.load(f)
|
|
|
|
|
|