argo-search 1.0.1 → 2.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -21
- package/README.en.md +822 -0
- package/README.es.md +864 -0
- package/README.ja.md +864 -0
- package/README.ko.md +864 -0
- package/README.md +867 -320
- package/SKILL.md +135 -0
- package/assets/readme/hero.svg +121 -0
- package/assets/readme/made-with-beautify.svg +10 -0
- package/assets/readme/proof-routes.svg +73 -0
- package/assets/readme/settings-keys.png +0 -0
- package/assets/readme/settings-tools.png +0 -0
- package/assets/readme/why-better.svg +104 -0
- package/assets/readme/workflow.svg +83 -0
- package/backends/domain_profiles.json +2308 -96
- package/backends/engine_registry.yaml +3314 -503
- package/backends/query_synonyms_cn.json +35 -0
- package/backends/quota_profiles.json +2409 -161
- package/backends/source_types_cn.json +83 -0
- package/backends/text_lexicon.json +44 -0
- package/bin/argo +703 -0
- package/bin/argo.js +71 -39
- package/config.yaml +4976 -363
- package/cordis.patch.yml +21 -0
- package/data/countries.json +40 -0
- package/data/lang_matrix/lang_capability.json +842 -0
- package/data/lang_matrix/matrix_2026-09-10.json +11921 -0
- package/data/regions_cn.json +1 -0
- package/docs/ADDING_NEW_ENGINE.md +184 -0
- package/docs/ARGO_INTRO.md +124 -0
- package/docs/DATA_SOURCE_GAPS.md +81 -0
- package/docs/DESIGN_LOCAL_DATA_FUSION.md +90 -0
- package/docs/ENGINE_CATALOG.md +564 -0
- package/docs/MCP_SETUP.md +106 -0
- package/docs/PLATFORM_PATHS.md +111 -0
- package/docs/RELEASE_NOTES_v2.8.0.md +71 -0
- package/docs/RELEASE_NOTES_v2.8.2.md +63 -0
- package/docs/RELEASE_NOTES_v2.8.3.md +55 -0
- package/docs/RELEASE_NOTES_v2.8.4.md +79 -0
- package/docs/RELEASE_NOTES_v2.8.5.md +102 -0
- package/docs/RELEASE_NOTES_v2.8.6.md +66 -0
- package/docs/RELEASE_NOTES_v2.8.7.md +65 -0
- package/docs/RELEASE_NOTES_v2.8.8.md +67 -0
- package/docs/RELEASE_NOTES_v2.8.9.md +67 -0
- package/docs/RELEASE_NOTES_v2.9.0.md +64 -0
- package/docs/SEARCH_ARCHIVE.md +115 -0
- package/docs/assets/architecture.svg +104 -0
- package/docs/assets/hero.svg +98 -0
- package/docs/engines/bangumi.md +27 -0
- package/docs/engines/biorxiv.md +27 -0
- package/docs/engines/clawhub.md +27 -0
- package/docs/engines/crt_sh.md +27 -0
- package/docs/engines/datacite.md +27 -0
- package/docs/engines/deps_dev.md +27 -0
- package/docs/engines/douban_movie.md +27 -0
- package/docs/engines/endoflife.md +27 -0
- package/docs/engines/flk_law.md +27 -0
- package/docs/engines/fxtwitter.md +27 -0
- package/docs/engines/google_news.md +27 -0
- package/docs/engines/gov_regulations.md +27 -0
- package/docs/engines/guqian.md +27 -0
- package/docs/engines/hackernews.md +27 -0
- package/docs/engines/iplant.md +27 -0
- package/docs/engines/keenable.md +27 -0
- package/docs/engines/met_museum.md +27 -0
- package/docs/engines/nasa_images.md +27 -0
- package/docs/engines/netease_music.md +27 -0
- package/docs/engines/npm.md +27 -0
- package/docs/engines/nvd.md +27 -0
- package/docs/engines/openreview.md +27 -0
- package/docs/engines/openstd.md +27 -0
- package/docs/engines/parallel_free.md +27 -0
- package/docs/engines/people_daily.md +27 -0
- package/docs/engines/realtime_index.md +27 -0
- package/docs/engines/sec_edgar.md +27 -0
- package/docs/engines/seltz.md +27 -0
- package/docs/engines/skillsmp.md +27 -0
- package/docs/engines/sspai.md +27 -0
- package/docs/engines/std_samr.md +27 -0
- package/docs/engines/train.md +27 -0
- package/docs/engines/un_comtrade.md +27 -0
- package/docs/engines/wikisource.md +27 -0
- package/docs/engines/zdic.md +27 -0
- package/docs/engines/zenodo.md +27 -0
- package/docs/engines/zhihu_hot_app.md +27 -0
- package/docs//344/270/272/344/273/200/344/271/210/351/200/211/346/213/251argo.md +176 -0
- package/engines/README.md +10 -0
- package/engines/_template_cli.yaml +39 -0
- package/engines/_template_http.yaml +37 -0
- package/engines/plugins/_template_plugin.py +50 -0
- package/engines/specs/_cisa_kev.yaml +54 -0
- package/engines/specs/_osv.yaml +63 -0
- package/engines/specs/aljazeera.yaml +43 -0
- package/engines/specs/antara.yaml +43 -0
- package/engines/specs/artic.yaml +20 -0
- package/engines/specs/aviation_weather.yaml +39 -0
- package/engines/specs/bangumi.yaml +21 -0
- package/engines/specs/biorxiv.yaml +24 -0
- package/engines/specs/carbon_intensity.yaml +32 -0
- package/engines/specs/cinii.yaml +44 -0
- package/engines/specs/clawhub.yaml +49 -0
- package/engines/specs/cleveland.yaml +19 -0
- package/engines/specs/cn_ai_news.yaml +43 -0
- package/engines/specs/core.yaml +35 -0
- package/engines/specs/crt_sh.yaml +38 -0
- package/engines/specs/ct24.yaml +43 -0
- package/engines/specs/datacite.yaml +27 -0
- package/engines/specs/datagov_uk.yaml +41 -0
- package/engines/specs/ddgs_images.yaml +45 -0
- package/engines/specs/deepseek_search.yaml +74 -0
- package/engines/specs/deezer.yaml +20 -0
- package/engines/specs/deps_dev.yaml +21 -0
- package/engines/specs/digup.yaml +36 -0
- package/engines/specs/doi.yaml +39 -0
- package/engines/specs/douban_movie.yaml +22 -0
- package/engines/specs/dw_news.yaml +47 -0
- package/engines/specs/egov_law.yaml +21 -0
- package/engines/specs/elpais.yaml +43 -0
- package/engines/specs/endoflife.yaml +21 -0
- package/engines/specs/energy_charts.yaml +21 -0
- package/engines/specs/factcheck_org.yaml +52 -0
- package/engines/specs/faz.yaml +43 -0
- package/engines/specs/federal_register.yaml +57 -0
- package/engines/specs/firecrawl.yaml +53 -0
- package/engines/specs/flk_law.yaml +24 -0
- package/engines/specs/folha.yaml +43 -0
- package/engines/specs/france24.yaml +44 -0
- package/engines/specs/full_fact.yaml +47 -0
- package/engines/specs/fxtwitter.yaml +31 -0
- package/engines/specs/gbfs_nyc.yaml +32 -0
- package/engines/specs/gdacs.yaml +21 -0
- package/engines/specs/gdelt.yaml +64 -0
- package/engines/specs/google_news.yaml +22 -0
- package/engines/specs/gov_regulations.yaml +38 -0
- package/engines/specs/guardian_rss.yaml +59 -0
- package/engines/specs/hurriyet.yaml +43 -0
- package/engines/specs/iplant.yaml +25 -0
- package/engines/specs/jikan.yaml +24 -0
- package/engines/specs/jolpica.yaml +20 -0
- package/engines/specs/k10plus.yaml +20 -0
- package/engines/specs/keenable.yaml +44 -0
- package/engines/specs/lefigaro.yaml +43 -0
- package/engines/specs/listenbrainz.yaml +19 -0
- package/engines/specs/matichon.yaml +43 -0
- package/engines/specs/met_museum.yaml +21 -0
- package/engines/specs/nasa_images.yaml +45 -0
- package/engines/specs/netease_music.yaml +38 -0
- package/engines/specs/nhk.yaml +43 -0
- package/engines/specs/nhtsa_vpic.yaml +20 -0
- package/engines/specs/noaa_swpc.yaml +20 -0
- package/engines/specs/nvd.yaml +38 -0
- package/engines/specs/obis.yaml +20 -0
- package/engines/specs/opencitations.yaml +52 -0
- package/engines/specs/openf1.yaml +21 -0
- package/engines/specs/openfoodfacts.yaml +45 -0
- package/engines/specs/openligadb.yaml +20 -0
- package/engines/specs/openreview.yaml +37 -0
- package/engines/specs/openstd.yaml +21 -0
- package/engines/specs/people_daily.yaml +22 -0
- package/engines/specs/realtime_index.yaml +34 -0
- package/engines/specs/ror.yaml +20 -0
- package/engines/specs/satnogs.yaml +20 -0
- package/engines/specs/sec_edgar.yaml +46 -0
- package/engines/specs/skillsmp.yaml +50 -0
- package/engines/specs/sogou_weixin_browser.yaml +30 -0
- package/engines/specs/soilgrids.yaml +25 -0
- package/engines/specs/sspai.yaml +36 -0
- package/engines/specs/stackexchange.yaml +46 -0
- package/engines/specs/std_samr.yaml +21 -0
- package/engines/specs/tass.yaml +43 -0
- package/engines/specs/tle_mirror.yaml +21 -0
- package/engines/specs/train.yaml +37 -0
- package/engines/specs/tvmaze.yaml +20 -0
- package/engines/specs/twitter_syndication.yaml +31 -0
- package/engines/specs/un_comtrade.yaml +23 -0
- package/engines/specs/unpaywall.yaml +54 -0
- package/engines/specs/vnpress.yaml +43 -0
- package/engines/specs/weather.yaml +32 -0
- package/engines/specs/who_don.yaml +21 -0
- package/engines/specs/who_gho.yaml +20 -0
- package/engines/specs/wikimedia_commons.yaml +34 -0
- package/engines/specs/wikisource.yaml +22 -0
- package/engines/specs/worms.yaml +19 -0
- package/engines/specs/x_trending.yaml +34 -0
- package/engines/specs/yna.yaml +43 -0
- package/engines/specs/ynet.yaml +43 -0
- package/engines/specs/zbmath.yaml +40 -0
- package/engines/specs/zdic.yaml +22 -0
- package/engines/specs/zenodo.yaml +27 -0
- package/engines/specs/zhihu_hot_app.yaml +35 -0
- package/mcp/clients.yaml +74 -0
- package/package.json +51 -12
- package/packages/dsh-plugin/README.md +134 -0
- package/packages/dsh-plugin/cordis.patch.yml +48 -0
- package/packages/dsh-plugin/dsh/client.js +1244 -0
- package/packages/dsh-plugin/dsh/index.js +2290 -0
- package/packages/dsh-plugin/dsh/native-tools.mjs +743 -0
- package/packages/dsh-plugin/package.json +38 -0
- package/packages/dsh-plugin/test/client.test.js +232 -0
- package/packages/dsh-plugin/test/config.test.js +30 -0
- package/packages/dsh-plugin/test/index.test.js +1338 -0
- package/references/query-templates.md +96 -0
- package/references/query-templates.yaml +118 -0
- package/scripts/ab_eval.py +219 -0
- package/scripts/ab_eval_p0p1.py +266 -0
- package/scripts/adaptive.py +271 -70
- package/scripts/answer.py +154 -0
- package/scripts/archive_run.py +591 -0
- package/scripts/argo_engine_registry.py +172 -0
- package/scripts/argo_paths.py +728 -0
- package/scripts/article.py +136 -0
- package/scripts/arxiv_source.py +201 -0
- package/scripts/badcase_ledger.py +252 -0
- package/scripts/batch_probe.py +241 -0
- package/scripts/benchmark.py +19 -0
- package/scripts/bounded_run.py +144 -0
- package/scripts/browser_auth.py +323 -0
- package/scripts/burstiness_detector.py +147 -0
- package/scripts/cache.py +1078 -67
- package/scripts/cache_guard.py +271 -0
- package/scripts/cache_key_vdom.py +56 -0
- package/scripts/cache_similarity.py +170 -0
- package/scripts/caliber_isolation.py +195 -0
- package/scripts/calibrate_lowquality.py +210 -0
- package/scripts/candidate_envelope.py +366 -0
- package/scripts/chrome_cdp.py +871 -0
- package/scripts/circuit_breaker.py +389 -0
- package/scripts/citations.py +334 -0
- package/scripts/cite_cli.py +59 -0
- package/scripts/cjk_tokens.py +95 -0
- package/scripts/clarify.py +47 -24
- package/scripts/cli_io.py +240 -0
- package/scripts/config.py +683 -45
- package/scripts/config_cache.py +402 -0
- package/scripts/conn_pool.py +220 -0
- package/scripts/content_security.py +685 -0
- package/scripts/content_signals.py +730 -0
- package/scripts/crawl.py +74 -35
- package/scripts/daemon.py +866 -0
- package/scripts/digup_bridge.py +214 -0
- package/scripts/engine_admission.py +366 -0
- package/scripts/engine_dispatch.py +1019 -0
- package/scripts/engine_env.py +534 -0
- package/scripts/engine_failure.py +411 -0
- package/scripts/engine_families.py +732 -0
- package/scripts/engine_policy.py +218 -0
- package/scripts/engine_requires.py +190 -0
- package/scripts/engine_status.py +322 -0
- package/scripts/engine_validate.py +638 -0
- package/scripts/engines.py +778 -294
- package/scripts/engines_base.py +1521 -0
- package/scripts/engines_builders.py +298 -0
- package/scripts/engines_builders_batch10.py +159 -0
- package/scripts/engines_builders_batch11.py +174 -0
- package/scripts/engines_builders_batch12.py +103 -0
- package/scripts/engines_builders_batch13.py +340 -0
- package/scripts/engines_builders_batch9.py +1468 -0
- package/scripts/engines_builders_cn.py +2283 -0
- package/scripts/engines_builders_data.py +2923 -0
- package/scripts/engines_builders_data_macro.py +775 -0
- package/scripts/engines_builders_feeds.py +255 -0
- package/scripts/engines_builders_intl.py +1239 -0
- package/scripts/engines_builders_search.py +440 -0
- package/scripts/engines_builders_tech.py +1360 -0
- package/scripts/evidence.py +588 -162
- package/scripts/evidence_loop.py +592 -0
- package/scripts/evidence_tier.py +298 -0
- package/scripts/except_sets.py +25 -0
- package/scripts/extract.py +55 -16
- package/scripts/fact_align.py +207 -0
- package/scripts/fact_crosscheck.py +230 -0
- package/scripts/fetch.py +25 -12
- package/scripts/fetch_browser.py +87 -0
- package/scripts/fetch_jsrun.py +122 -0
- package/scripts/fetch_quality.py +225 -0
- package/scripts/fetch_render_tinyfish.py +117 -0
- package/scripts/fetch_v3.py +1779 -0
- package/scripts/focus_extract.py +350 -0
- package/scripts/fulltext_store.py +169 -0
- package/scripts/fxtwitter_api.py +325 -0
- package/scripts/gen_engine_catalog.py +364 -0
- package/scripts/gen_native_tools.py +91 -0
- package/scripts/gen_routing_snapshot.py +184 -0
- package/scripts/health_check.py +140 -402
- package/scripts/health_probe.py +23 -8
- package/scripts/hot_state.py +134 -0
- package/scripts/http_client.py +1053 -0
- package/scripts/image_ops.py +430 -0
- package/scripts/image_vision/vision_probe +0 -0
- package/scripts/image_vision/vision_probe.swift +126 -0
- package/scripts/install.ps1 +148 -0
- package/scripts/install.sh +206 -0
- package/scripts/job.py +1186 -0
- package/scripts/jump_resolver.py +235 -0
- package/scripts/lang_capability.py +150 -0
- package/scripts/lang_detect.py +289 -0
- package/scripts/lang_matrix_probe.py +329 -0
- package/scripts/lang_pref.py +311 -0
- package/scripts/link_source.py +340 -0
- package/scripts/local_engines.py +321 -0
- package/scripts/local_image.py +970 -0
- package/scripts/local_seek.py +366 -0
- package/scripts/macro_countries.py +82 -0
- package/scripts/matrix_search_eval.py +1105 -0
- package/scripts/mcp_diag.py +8 -3
- package/scripts/mcp_handlers.py +1074 -0
- package/scripts/mcp_handlers_surface.py +157 -0
- package/scripts/mcp_launch.sh +122 -0
- package/scripts/mcp_server.py +118 -417
- package/scripts/mcp_setup.py +407 -0
- package/scripts/mcp_tools.py +330 -0
- package/scripts/mcp_transport.py +191 -0
- package/scripts/min_version_scan.py +335 -0
- package/scripts/net_proxy.py +258 -0
- package/scripts/network_aware.py +152 -0
- package/scripts/paper.py +274 -0
- package/scripts/pdf_extract.py +518 -0
- package/scripts/phrase_filter.py +66 -0
- package/scripts/plan.py +422 -0
- package/scripts/postprocess_signals.py +150 -0
- package/scripts/pre-commit +48 -0
- package/scripts/query_enhance.py +157 -0
- package/scripts/query_operators.py +196 -0
- package/scripts/query_rewriter.py +116 -7
- package/scripts/query_signals.py +300 -0
- package/scripts/query_templates.py +167 -0
- package/scripts/query_understanding.py +411 -0
- package/scripts/query_variants.py +298 -0
- package/scripts/quota.py +488 -76
- package/scripts/rank_signals.py +775 -0
- package/scripts/ranking_eval.py +319 -0
- package/scripts/readability_extract.py +433 -0
- package/scripts/recompute.py +415 -0
- package/scripts/recovery.py +616 -0
- package/scripts/recovery_l0.py +160 -0
- package/scripts/redskill/redskill_engine.py +332 -0
- package/scripts/regression_p0p1.py +318 -0
- package/scripts/replay_eval.py +640 -0
- package/scripts/rerank_tfidf.py +225 -0
- package/scripts/research.py +591 -403
- package/scripts/research_cli.py +361 -0
- package/scripts/research_dossier.py +492 -0
- package/scripts/research_expand.py +146 -0
- package/scripts/research_gates.py +272 -0
- package/scripts/research_report.py +209 -0
- package/scripts/research_strategy.py +37 -0
- package/scripts/research_work_packages.py +195 -0
- package/scripts/result_lang.py +311 -0
- package/scripts/robots_guard.py +259 -0
- package/scripts/route.py +921 -254
- package/scripts/route_bangs.py +40 -0
- package/scripts/route_cache.py +225 -0
- package/scripts/route_combo.py +910 -0
- package/scripts/route_domains.py +328 -0
- package/scripts/route_lang.py +605 -0
- package/scripts/route_log.py +63 -0
- package/scripts/route_policy.py +250 -0
- package/scripts/rrf_classic.py +66 -0
- package/scripts/screenshot.py +73 -0
- package/scripts/search.py +897 -405
- package/scripts/search_attribution.py +88 -0
- package/scripts/search_benchmark.py +407 -0
- package/scripts/search_cli.py +627 -0
- package/scripts/search_entry.py +389 -0
- package/scripts/search_output.py +606 -0
- package/scripts/search_pipeline.py +1077 -0
- package/scripts/search_rank.py +991 -0
- package/scripts/search_types.py +27 -12
- package/scripts/seek_locator.py +68 -0
- package/scripts/semantic_evidence.py +215 -0
- package/scripts/serp_guard.py +228 -0
- package/scripts/serp_kill_log.py +51 -0
- package/scripts/single_flight.py +120 -0
- package/scripts/social_engines/__init__.py +10 -0
- package/scripts/social_engines/bilibili_engine.py +131 -0
- package/scripts/social_engines/hackernews_engine.py +113 -0
- package/scripts/social_engines/reddit_engine.py +172 -0
- package/scripts/social_engines/twitter_engine.py +397 -0
- package/scripts/social_engines/v2ex_engine.py +101 -0
- package/scripts/social_engines/weibo_engine.py +128 -0
- package/scripts/social_engines/xiaohongshu_engine.py +137 -0
- package/scripts/social_engines/zhihu_engine.py +139 -0
- package/scripts/social_research.py +201 -0
- package/scripts/sogou_weixin_browser.py +318 -0
- package/scripts/source_ledger.py +249 -0
- package/scripts/stage_timing.py +58 -0
- package/scripts/stats_cli.py +95 -0
- package/scripts/straggler_policy.py +60 -0
- package/scripts/stylometry_detector.py +231 -0
- package/scripts/sync_backends.py +353 -0
- package/scripts/sync_installs.py +29 -0
- package/scripts/template_cli.py +127 -0
- package/scripts/text_lexicon.py +72 -0
- package/scripts/tfidf_router.py +109 -37
- package/scripts/time_utils.py +233 -0
- package/scripts/topic_research_profiles.py +643 -0
- package/scripts/train.py +737 -0
- package/scripts/tweet.py +596 -0
- package/scripts/url_canon.py +217 -0
- package/scripts/url_optimize.py +56 -0
- package/scripts/url_safety.py +236 -0
- package/scripts/usage_log.py +116 -0
- package/scripts/usage_log_clean.py +113 -0
- package/scripts/v2ex_nodes.py +311 -0
- package/scripts/variant_recall.py +188 -0
- package/scripts/watch.py +205 -0
- package/scripts/wechat_article.py +258 -0
- package/scripts/wide_research.py +402 -0
- package/scripts/wx.py +349 -0
- package/scripts/x_article_fetch.py +141 -0
- package/scripts/x_search.py +234 -0
- package/scripts/x_trending.py +189 -0
- package/scripts/yaml_load.py +67 -0
- package/sub-skills/ego-search/SKILL.md +253 -0
- package/sub-skills/ego-search/references/browser-runtime.md +43 -0
- package/sub-skills/ego-search/references/install.md +67 -0
- package/sub-skills/ego-search/references/original-ego-upgrade.md +51 -0
- package/sub-skills/ego-search/scripts/ego_search.py +800 -0
- package/sub-skills/ego-search/scripts/merge.py +226 -0
- package/sub-skills/ego-search/scripts/quality.py +64 -0
- package/sub-skills/ego-search/scripts/runtime.py +172 -0
- package/sub-skills/ego-search/scripts/safety.py +109 -0
- package/sub-skills/ego-search/scripts/serp_spec.py +109 -0
- package/sub-skills/ego-search/scripts/webbridge_adapter.py +374 -0
- package/sub-skills/ego-search/tests/test_query_normalize.py +68 -0
- package/sub-skills/js-run/SKILL.md +67 -0
- package/sub-skills/js-run/scripts/jsrun.py +112 -0
- package/sub-skills/js-run/scripts/shim.js +188 -0
- package/sub-skills/js-run/tests/fixtures/challenge_like.js +27 -0
- package/sub-skills/js-run/tests/test_jsrun.py +165 -0
- package/sub-skills/local-search/SKILL.md +50 -53
- package/sub-skills/local-search/bm25.py +162 -0
- package/sub-skills/local-search/config.yaml +152 -55
- package/sub-skills/local-search/engine_registry.py +91 -26
- package/sub-skills/local-search/{health_check.py → local_health_check.py} +140 -10
- package/sub-skills/local-search/local_search_adapter.py +13 -2
- package/sub-skills/local-search/parse_maps.yaml +40 -42
- package/sub-skills/local-search/search_v3.py +1182 -65
- package/sub-skills/local-search/smart_router.py +47 -7
- package/sub-skills/local-seek/SKILL.md +110 -0
- package/sub-skills/local-seek/config/domains.yaml +20 -0
- package/sub-skills/local-seek/references/auto-behaviors.md +24 -0
- package/sub-skills/local-seek/references/fd-mdfind-recipes.md +62 -0
- package/sub-skills/local-seek/references/git-integration.md +54 -0
- package/sub-skills/local-seek/references/remote-handoff.md +46 -0
- package/sub-skills/local-seek/references/rg-recipes.md +96 -0
- package/sub-skills/local-seek/references/strategies.md +52 -0
- package/sub-skills/local-seek/references/structural-search.md +59 -0
- package/sub-skills/local-seek/scripts/eval_rank.py +216 -0
- package/sub-skills/local-seek/scripts/eval_seek.py +224 -0
- package/sub-skills/local-seek/scripts/seek.py +1465 -0
- package/sub-skills/local-seek/scripts/seek_frecency.py +126 -0
- package/sub-skills/local-seek/scripts/seek_fts.py +430 -0
- package/sub-skills/local-seek/scripts/seek_rank.py +193 -0
- package/sub-skills/local-seek/tests/test_content_rank.py +222 -0
- package/sub-skills/local-seek/tests/test_determinism_20261006.py +145 -0
- package/sub-skills/local-seek/tests/test_noise_tier.py +101 -0
- package/sub-skills/local-seek/tests/test_pcre2_probe.py +136 -0
- package/sub-skills/local-seek/tests/test_rank_pinyin.py +77 -0
- package/sub-skills/local-seek/tests/test_regression_20261003.py +169 -0
- package/sub-skills/local-seek/tests/test_regression_20261006.py +146 -0
- package/sub-skills/local-seek/tests/test_seek_degradation.py +111 -0
- package/sub-skills/local-seek/tests/test_seek_fts.py +313 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""stats_cli.py — `argo stats`:使用日志与反馈状态的读出口。
|
|
3
|
+
|
|
4
|
+
数据源 = usage_log.py 的本地 JSONL 日志流(<状态目录>/usage_log/,总开关
|
|
5
|
+
ARGO_USAGE_LOG=0 可关,目录 ARGO_USAGE_LOG_DIR 可注入):
|
|
6
|
+
query 每次非缓存搜索一条总账(次数/引擎/命中数/时延/救援)
|
|
7
|
+
recovery 救援链触发概览
|
|
8
|
+
route 路由采样
|
|
9
|
+
merge 融合去重概览
|
|
10
|
+
|
|
11
|
+
纪律:只读不写;本地数据不出本机(隐私判据见 references/usage.md「日志与反馈」)。
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
import json
|
|
18
|
+
import sys
|
|
19
|
+
from collections import Counter
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
23
|
+
|
|
24
|
+
import usage_log # noqa: E402
|
|
25
|
+
from cli_io import dumps # noqa: E402
|
|
26
|
+
from search_attribution import aggregate_slow_engines # noqa: E402
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _query_summary(n: int) -> dict:
|
|
30
|
+
rows = usage_log.tail("query", n)
|
|
31
|
+
if not rows:
|
|
32
|
+
return {"samples": 0}
|
|
33
|
+
counts = [r.get("count", 0) for r in rows]
|
|
34
|
+
lat = [r.get("elapsed_ms") for r in rows if isinstance(r.get("elapsed_ms"), (int, float))]
|
|
35
|
+
engines: Counter = Counter()
|
|
36
|
+
# 引擎级耗时归因(2026-10-15):query 流新增 engine_latency_top,
|
|
37
|
+
# 这里按「慢源累计耗时」排序,把「长期是谁在拖」直接摆到 stats 上——
|
|
38
|
+
# 此前只能离线重算日志(local_search 独跑占 369s 就是这么翻出来的)。
|
|
39
|
+
# 聚合是纯函数,住 search_attribution(与写侧同一份口径真源)。
|
|
40
|
+
for r in rows:
|
|
41
|
+
for e in (r.get("engines_used") or [])[:8]:
|
|
42
|
+
engines[e] += 1
|
|
43
|
+
return {
|
|
44
|
+
"samples": len(rows),
|
|
45
|
+
# 2026-10-18 改名:原字段叫 hit_rate,实际算的是「有结果的查询比例」
|
|
46
|
+
# (count>0),与 SearchCache.stats 的缓存命中率同名不同义——实测被
|
|
47
|
+
# 读成「缓存全命中」(=1.0)。保留语义,换掉会误导的名字。
|
|
48
|
+
"result_rate": round(sum(1 for c in counts if c) / len(rows), 3),
|
|
49
|
+
"avg_elapsed_ms": round(sum(lat) / len(lat)) if lat else None,
|
|
50
|
+
"recovered": sum(1 for r in rows if r.get("recovered")),
|
|
51
|
+
"top_engines": engines.most_common(5),
|
|
52
|
+
"slowest_engines": aggregate_slow_engines(rows),
|
|
53
|
+
"recent": [
|
|
54
|
+
{"query": r.get("query"), "count": r.get("count"),
|
|
55
|
+
"elapsed_ms": r.get("elapsed_ms")}
|
|
56
|
+
for r in rows[-5:]
|
|
57
|
+
],
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _stream_summary(name: str, n: int) -> dict:
|
|
62
|
+
rows = usage_log.tail(name, n)
|
|
63
|
+
return {"samples": len(rows), "recent": rows[-3:]}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def build_report(n: int) -> dict:
|
|
67
|
+
return {
|
|
68
|
+
"data_dir": str(usage_log.stream_dir()),
|
|
69
|
+
"privacy": "本地使用日志 JSONL,仅本机不外发;ARGO_USAGE_LOG=0 可整体关闭",
|
|
70
|
+
"query": _query_summary(n),
|
|
71
|
+
"recovery": _stream_summary("recovery", n),
|
|
72
|
+
"route": _stream_summary("route", n),
|
|
73
|
+
"merge": _stream_summary("merge", n),
|
|
74
|
+
"hints": [
|
|
75
|
+
"流量回放/审计:argo search --archive(完整候选归档)",
|
|
76
|
+
"引擎健康:argo preflight --probe / --list-engines --detail",
|
|
77
|
+
"关闭日志:ARGO_USAGE_LOG=0",
|
|
78
|
+
],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def main(argv: list[str] | None = None) -> int:
|
|
83
|
+
ap = argparse.ArgumentParser(
|
|
84
|
+
prog="argo stats", description="使用日志与反馈状态(本地使用日志只读出口)")
|
|
85
|
+
ap.add_argument("-n", type=int, default=50, help="回看最近 N 条(默认 50)")
|
|
86
|
+
ap.add_argument("--json", action="store_true", help="JSON 输出")
|
|
87
|
+
args = ap.parse_args(argv)
|
|
88
|
+
report = build_report(max(1, min(args.n, 500)))
|
|
89
|
+
out = dumps(report)
|
|
90
|
+
print(out if args.json else out)
|
|
91
|
+
return 0
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
if __name__ == "__main__":
|
|
95
|
+
sys.exit(main())
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""straggler_policy.py — 收尾尾宽的取值策略(2026-10-16 从 search.py 拆出)。
|
|
3
|
+
|
|
4
|
+
拆出原因:取值函数是**纯策略**(读开关 + 读自适应学习器 + 分档表),不
|
|
5
|
+
依赖 search.py 的任何东西;放在 search.py 里只为「和其他旋钮常量做邻居」。
|
|
6
|
+
search.py 是被 module size 门禁盯着的文件(1000 行硬限),本次拆出顺带
|
|
7
|
+
把尾宽策略的判据(为什么是 0.7/0.4、fail-open 契约、默认关的理由)集中到
|
|
8
|
+
一处,调用侧只留一行接线。
|
|
9
|
+
|
|
10
|
+
默认关(ARGO_ADAPTIVE_TAIL=1 开启):理由是**本开关自己的**交错 A/B 未证实
|
|
11
|
+
收益——2026-10-16 三轮对拍见
|
|
12
|
+
docs-local/调度对拍_尾宽分层与并发_2026-10-16.md:墙钟有改善但统计不显著,
|
|
13
|
+
按「调度旋钮的收益必须由 A/B 证明后才转默认开」的规矩保持关闭。
|
|
14
|
+
别拿 ARGO_ADAPTIVE_GRACE 的现状作类比:那个 2026-10-19(c52b7d4)已转默认
|
|
15
|
+
开,两者的 A/B 结论不同,各自独立判断。
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
__all__ = ["straggler_tail"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def straggler_tail(engine: str, base: float) -> float:
|
|
24
|
+
"""尾宽按 backup 引擎历史 P75 分层(ARGO_ADAPTIVE_TAIL 覆盖,默认关)。
|
|
25
|
+
|
|
26
|
+
固定 1.5s 尾宽对一切 backup 一视同仁,而 backup 的 P75 差异极大:
|
|
27
|
+
redskill 236ms、eastmoney 258ms 这类等 1.5s 几乎必到(耐心有回报),
|
|
28
|
+
anysearch P75 2.6s 等 1.5s 只有约五成概率——等不到就是纯墙钟。消融实测
|
|
29
|
+
(2026-10-15,ARGO_STRAGGLER_GRACE_S 1.5 → 0.5 → 0):样本墙钟
|
|
30
|
+
2581 → 2260 → 1873ms(-12% / -27%),证明尾宽是有效杠杆且当前值是
|
|
31
|
+
拍的常数。分层让「值得等的等满、不值得等的早收工」:
|
|
32
|
+
P75 ≤ ½·base(快源) → base 尾窗内几乎必到,等满不损质量
|
|
33
|
+
½·base < P75 ≤ 1.5·base → 0.7·base 中速略收
|
|
34
|
+
P75 > 1.5·base(慢源) → 0.4·base(下限 0.3s)大概率白等,早收工
|
|
35
|
+
|
|
36
|
+
P75 取 adaptive.latency_percentile(7 天窗、仅 success 且非空交付,
|
|
37
|
+
与 engine_dispatch._adaptive_grace 同源同口径);样本不足/过时/任何
|
|
38
|
+
异常 → 原样返回 base(fail-open,观测层不阻断调度主路径)。
|
|
39
|
+
"""
|
|
40
|
+
if base <= 0 or not engine:
|
|
41
|
+
return base
|
|
42
|
+
try:
|
|
43
|
+
from engine_env import env_flag
|
|
44
|
+
if not env_flag("ARGO_ADAPTIVE_TAIL", False):
|
|
45
|
+
return base
|
|
46
|
+
except Exception:
|
|
47
|
+
return base
|
|
48
|
+
try:
|
|
49
|
+
from adaptive import get_learner
|
|
50
|
+
p75_ms = get_learner().latency_percentile(engine, 0.75)
|
|
51
|
+
except Exception:
|
|
52
|
+
return base
|
|
53
|
+
if not p75_ms or p75_ms <= 0:
|
|
54
|
+
return base
|
|
55
|
+
p75 = float(p75_ms) / 1000.0
|
|
56
|
+
if p75 <= base * 0.5:
|
|
57
|
+
return base
|
|
58
|
+
if p75 <= base * 1.5:
|
|
59
|
+
return base * 0.7
|
|
60
|
+
return max(0.3, base * 0.4)
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""stylometry_detector.py — 文体特征检测器
|
|
3
|
+
|
|
4
|
+
基于 EMNLP 2019 论文《The Limitations of Stylometry for Detecting
|
|
5
|
+
Machine-Generated Fake News》的文体特征方法,识别 AI 生成/内容农场文本。
|
|
6
|
+
|
|
7
|
+
核心思想:
|
|
8
|
+
AI 生成文本与人类写作在文体特征上有显著差异:
|
|
9
|
+
- 词汇丰富度(Type-Token Ratio):AI 文本词汇多样性低
|
|
10
|
+
- 句长分布:AI 文本句长方差小(过于均匀)
|
|
11
|
+
- 标点使用模式:AI 文本标点使用过于规范
|
|
12
|
+
- 功能词频率:AI 文本功能词(the/is/and)频率异常
|
|
13
|
+
- 重复 n-gram 比例:AI 文本重复模式多
|
|
14
|
+
|
|
15
|
+
设计原则:
|
|
16
|
+
- 纯 stdlib,零依赖,微秒级
|
|
17
|
+
- 与 content_signals 集成,作为低质内容检测的补充信号
|
|
18
|
+
- 输出 0-1 分数,越高越像 AI 生成
|
|
19
|
+
|
|
20
|
+
参考文献:
|
|
21
|
+
- Shu et al. "The Limitations of Stylometry for Detecting Machine-Generated
|
|
22
|
+
Fake News" EMNLP 2019
|
|
23
|
+
- NewsGuard + Pangram Labs AI Content Farm Detection (2025)
|
|
24
|
+
"""
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import re
|
|
28
|
+
import math
|
|
29
|
+
from typing import Any
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# ── 常量 ────────────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
# 功能词列表(中英文)
|
|
35
|
+
_FUNCTION_WORDS = frozenset([
|
|
36
|
+
# 英文功能词
|
|
37
|
+
"the", "be", "to", "of", "and", "a", "in", "that", "have", "i",
|
|
38
|
+
"it", "for", "not", "on", "with", "he", "as", "you", "do", "at",
|
|
39
|
+
"this", "but", "his", "by", "from", "they", "we", "say", "her", "she",
|
|
40
|
+
"or", "an", "will", "my", "one", "all", "would", "there", "their",
|
|
41
|
+
"what", "so", "up", "out", "if", "about", "who", "get", "which", "go",
|
|
42
|
+
"me", "when", "make", "can", "like", "time", "no", "just", "him", "know",
|
|
43
|
+
"take", "people", "into", "year", "your", "good", "some", "could", "them",
|
|
44
|
+
"see", "other", "than", "then", "now", "look", "only", "come", "its", "over",
|
|
45
|
+
"think", "also", "back", "after", "use", "two", "how", "our", "work",
|
|
46
|
+
"first", "well", "way", "even", "new", "want", "because", "any", "these",
|
|
47
|
+
"give", "day", "most", "us",
|
|
48
|
+
# 中文功能词
|
|
49
|
+
"的", "了", "在", "是", "我", "有", "和", "就", "不", "人", "都", "一",
|
|
50
|
+
"一个", "上", "也", "很", "到", "说", "要", "去", "你", "会", "着",
|
|
51
|
+
"没有", "看", "好", "自己", "这", "他", "她", "它", "们", "那", "些",
|
|
52
|
+
"什么", "怎么", "为什么", "多少", "几", "谁", "哪", "哪个", "哪些",
|
|
53
|
+
])
|
|
54
|
+
|
|
55
|
+
# 模板词(AI 生成文本高频)
|
|
56
|
+
_TEMPLATE_WORDS = frozenset([
|
|
57
|
+
"综上所述", "值得注意的是", "总而言之", "首先", "其次", "最后",
|
|
58
|
+
"in conclusion", "it is worth noting", "in summary", "firstly", "secondly",
|
|
59
|
+
"moreover", "furthermore", "additionally", "consequently", "therefore",
|
|
60
|
+
"nevertheless", "nonetheless", "in addition", "as a result", "in fact",
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
# 句子分割模式
|
|
64
|
+
_SENTENCE_RE = re.compile(r'[.!?。!?]+')
|
|
65
|
+
# 单词分割
|
|
66
|
+
_WORD_RE = re.compile(r'[a-zA-Z]+|\u4e00-\u9fff')
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _split_sentences(text: str) -> list[str]:
|
|
70
|
+
"""分割句子"""
|
|
71
|
+
if not text:
|
|
72
|
+
return []
|
|
73
|
+
parts = _SENTENCE_RE.split(text)
|
|
74
|
+
return [p.strip() for p in parts if p.strip()]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _tokenize(text: str) -> list[str]:
|
|
78
|
+
"""分词(中英文混合)"""
|
|
79
|
+
if not text:
|
|
80
|
+
return []
|
|
81
|
+
return _WORD_RE.findall(text.lower())
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _variance(data: list[float]) -> float:
|
|
85
|
+
"""计算方差"""
|
|
86
|
+
if len(data) < 2:
|
|
87
|
+
return 0.0
|
|
88
|
+
mean = sum(data) / len(data)
|
|
89
|
+
return sum((x - mean) ** 2 for x in data) / len(data)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _quantile(data: list[float], q: float) -> float:
|
|
93
|
+
"""计算分位数"""
|
|
94
|
+
if not data:
|
|
95
|
+
return 0.0
|
|
96
|
+
sorted_data = sorted(data)
|
|
97
|
+
idx = int(len(sorted_data) * q)
|
|
98
|
+
return sorted_data[min(idx, len(sorted_data) - 1)]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class StylometryDetector:
|
|
102
|
+
"""文体特征检测器 — 识别 AI 生成/内容农场文本"""
|
|
103
|
+
|
|
104
|
+
def extract_features(self, text: str) -> dict[str, float]:
|
|
105
|
+
"""提取文体特征
|
|
106
|
+
|
|
107
|
+
返回:
|
|
108
|
+
type_token_ratio: 词汇丰富度(0-1,越高越丰富)
|
|
109
|
+
sentence_length_variance: 句长方差(越大越自然)
|
|
110
|
+
punctuation_density: 标点密度
|
|
111
|
+
function_word_ratio: 功能词比例
|
|
112
|
+
repeated_ngram_ratio: 重复 n-gram 比例
|
|
113
|
+
template_word_ratio: 模板词比例
|
|
114
|
+
"""
|
|
115
|
+
if not text or len(text.strip()) < 10:
|
|
116
|
+
return {
|
|
117
|
+
"type_token_ratio": 0.0,
|
|
118
|
+
"sentence_length_variance": 0.0,
|
|
119
|
+
"punctuation_density": 0.0,
|
|
120
|
+
"function_word_ratio": 0.0,
|
|
121
|
+
"repeated_ngram_ratio": 0.0,
|
|
122
|
+
"template_word_ratio": 0.0,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
sentences = _split_sentences(text)
|
|
126
|
+
words = _tokenize(text)
|
|
127
|
+
|
|
128
|
+
# 1. 词汇丰富度(Type-Token Ratio)
|
|
129
|
+
unique_words = len(set(words))
|
|
130
|
+
total_words = len(words)
|
|
131
|
+
type_token_ratio = unique_words / max(total_words, 1)
|
|
132
|
+
|
|
133
|
+
# 2. 句长方差(AI 文本方差小)
|
|
134
|
+
sentence_lengths = [len(s) for s in sentences]
|
|
135
|
+
sentence_length_variance = _variance(sentence_lengths)
|
|
136
|
+
|
|
137
|
+
# 3. 标点密度
|
|
138
|
+
punctuation_count = text.count(',') + text.count(',') + text.count('、')
|
|
139
|
+
punctuation_density = punctuation_count / max(len(text), 1)
|
|
140
|
+
|
|
141
|
+
# 4. 功能词比例
|
|
142
|
+
function_word_count = sum(1 for w in words if w in _FUNCTION_WORDS)
|
|
143
|
+
function_word_ratio = function_word_count / max(total_words, 1)
|
|
144
|
+
|
|
145
|
+
# 5. 重复 n-gram 比例(3-gram)
|
|
146
|
+
repeated_ngram_ratio = self._repeated_ngram_ratio(words, n=3)
|
|
147
|
+
|
|
148
|
+
# 6. 模板词比例
|
|
149
|
+
template_word_count = sum(1 for w in words if w in _TEMPLATE_WORDS)
|
|
150
|
+
template_word_ratio = template_word_count / max(total_words, 1)
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
"type_token_ratio": round(type_token_ratio, 4),
|
|
154
|
+
"sentence_length_variance": round(sentence_length_variance, 2),
|
|
155
|
+
"punctuation_density": round(punctuation_density, 4),
|
|
156
|
+
"function_word_ratio": round(function_word_ratio, 4),
|
|
157
|
+
"repeated_ngram_ratio": round(repeated_ngram_ratio, 4),
|
|
158
|
+
"template_word_ratio": round(template_word_ratio, 4),
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
def _repeated_ngram_ratio(self, words: list[str], n: int = 3) -> float:
|
|
162
|
+
"""计算重复 n-gram 比例"""
|
|
163
|
+
if len(words) < n:
|
|
164
|
+
return 0.0
|
|
165
|
+
ngrams = [tuple(words[i:i+n]) for i in range(len(words) - n + 1)]
|
|
166
|
+
unique_ngrams = len(set(ngrams))
|
|
167
|
+
total_ngrams = len(ngrams)
|
|
168
|
+
if total_ngrams == 0:
|
|
169
|
+
return 0.0
|
|
170
|
+
return 1.0 - (unique_ngrams / total_ngrams)
|
|
171
|
+
|
|
172
|
+
def score(self, text: str) -> dict[str, Any]:
|
|
173
|
+
"""计算文体异常分数
|
|
174
|
+
|
|
175
|
+
返回:
|
|
176
|
+
score: 0-1,越高越像 AI 生成
|
|
177
|
+
features: 原始特征
|
|
178
|
+
is_suspicious: 是否可疑(score > 0.6)
|
|
179
|
+
"""
|
|
180
|
+
if not text or len(text.strip()) < 20:
|
|
181
|
+
return {
|
|
182
|
+
"score": 0.0,
|
|
183
|
+
"features": {},
|
|
184
|
+
"is_suspicious": False,
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
features = self.extract_features(text)
|
|
188
|
+
|
|
189
|
+
# 基于数据分析的权重设计
|
|
190
|
+
# 实测数据:
|
|
191
|
+
# AI 文本:TTR=0.17-0.55, Var=38-61, Rep=0.03-0.75, Tpl=0.04-0.06
|
|
192
|
+
# 人类文本:TTR=0.50-0.87, Var=106-875, Rep=0.00, Tpl=0.01-0.02
|
|
193
|
+
# 内容农场:TTR=0.37, Var=312, Rep=0.32, Tpl=0.04
|
|
194
|
+
|
|
195
|
+
# 1. 句长方差(区分度最高:AI=38-61, Human=106-875)
|
|
196
|
+
# AI 文本方差通常 < 100,人类文本 > 100
|
|
197
|
+
variance_score = 1.0 - min(features["sentence_length_variance"] / 100, 1.0)
|
|
198
|
+
|
|
199
|
+
# 2. 词汇丰富度(区分度低,因为中文人类 TTR 也低)
|
|
200
|
+
# 仅当 TTR < 0.3 时才算异常(AI 生成中文 TTR=0.17)
|
|
201
|
+
lexical_score = max(0, 1.0 - features["type_token_ratio"] / 0.3)
|
|
202
|
+
|
|
203
|
+
# 3. 模板词比例(区分度高:AI=0.04-0.06, Human=0.01-0.02)
|
|
204
|
+
template_score = min(max(features["template_word_ratio"] - 0.02, 0) / 0.02, 1.0)
|
|
205
|
+
|
|
206
|
+
# 4. 功能词比例(区分度低,作为辅助信号)
|
|
207
|
+
function_score = max(0, (0.38 - features["function_word_ratio"]) / 0.08)
|
|
208
|
+
|
|
209
|
+
# 5. 重复 n-gram 比例(区分度最高:AI=0.03-0.75, Human=0.00)
|
|
210
|
+
repetition_score = min(features["repeated_ngram_ratio"] * 2, 1.0)
|
|
211
|
+
|
|
212
|
+
# 加权组合(重复 n-gram 和句长方差是强信号)
|
|
213
|
+
score = (
|
|
214
|
+
variance_score * 0.25 +
|
|
215
|
+
lexical_score * 0.15 +
|
|
216
|
+
template_score * 0.20 +
|
|
217
|
+
function_score * 0.10 +
|
|
218
|
+
repetition_score * 0.30
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
"score": round(min(score, 1.0), 3),
|
|
223
|
+
"features": features,
|
|
224
|
+
"is_suspicious": score > 0.35,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
def detect_ai_generated(text: str) -> dict[str, Any]:
|
|
229
|
+
"""便捷函数:检测文本是否 AI 生成"""
|
|
230
|
+
detector = StylometryDetector()
|
|
231
|
+
return detector.score(text)
|