Address review feedback: deduplicate query_type, clean unused imports, fix defaults
- Remove duplicate detect_query_type from query.py (divergent 5-type version); canonical 7-type version lives in query_type.py - Fix reddit.py import to use query_type.detect_query_type - Clean unused STOPWORDS/SYNONYMS/tokenize imports from youtube_yt, instagram, tiktok, scrapecreators_x, bird_x after relevance consolidation - Fix _relevance_filter default from 0.7 to 0.0 (items without relevance should not silently pass the filter) - Remove --dateafter from yt-dlp (returns 0 results for evergreen topics) - Remove restrictSearchableAttributes from HN search (misses Ask/Show HN) - Lower HN points filter from >5 to >2 (avoids filtering niche posts) - Add error logging to select_openai_model HTTP failures - Remove mise.toml and internal planning doc from repo - Update module docstrings to describe current purpose, not migration history - Update tests to import from canonical relevance module
This commit is contained in:
+1
-22
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "scripts"))
|
||||
|
||||
from lib.query import NOISE_WORDS, detect_query_type, extract_compound_terms, extract_core_subject
|
||||
from lib.query import NOISE_WORDS, extract_compound_terms, extract_core_subject
|
||||
|
||||
|
||||
class TestExtractCoreSubject(unittest.TestCase):
|
||||
@@ -126,27 +126,6 @@ class TestNoiseWordsCompleteness(unittest.TestCase):
|
||||
self.assertIn(w, NOISE_WORDS)
|
||||
|
||||
|
||||
class TestDetectQueryType(unittest.TestCase):
|
||||
"""Tests for detect_query_type()."""
|
||||
|
||||
def test_comparison(self):
|
||||
self.assertEqual(detect_query_type("React vs Vue"), "comparison")
|
||||
|
||||
def test_how_to(self):
|
||||
self.assertEqual(detect_query_type("how to deploy on Vercel"), "how_to")
|
||||
|
||||
def test_opinion(self):
|
||||
self.assertEqual(detect_query_type("cursor IDE worth it"), "opinion")
|
||||
|
||||
def test_product(self):
|
||||
self.assertEqual(detect_query_type("cursor IDE pricing"), "product")
|
||||
|
||||
def test_concept_default(self):
|
||||
self.assertEqual(detect_query_type("multi-agent reinforcement learning"), "concept")
|
||||
|
||||
def test_how_prefix(self):
|
||||
self.assertEqual(detect_query_type("how does Claude work"), "how_to")
|
||||
|
||||
|
||||
class TestExtractCompoundTerms(unittest.TestCase):
|
||||
"""Tests for extract_compound_terms()."""
|
||||
|
||||
Reference in New Issue
Block a user