Files
Shadowbroker/backend/tests/test_gt_feed_adapter_translate.py
T
Shadowbroker cfbeabda1e Feat/gt analytics openclaw (#392)
* feat(telegram): auto-translate OSINT channel posts to English

Cherry-picked from @Bobpick PR #391 (telegram-only slice): server-side translation during fetch, SHOW ORIGINAL toggle in TelegramOsintPopup, and on-demand /api/telegram-feed?lang=.

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(gt): experimental Derived OSINT analytics with lean-node safeguards

Cherry-picked from @Bobpick PR #391 (GT + OpenClaw slice): Bayesian strategic-risk engine, map overlay, OpenClaw commands, and telegram_rhetoric watchdog. Off by default (GT_ANALYTICS_ENABLED=false, gt_risk layer false). 1 vCPU nodes get cgroup detection, UI warning on layer toggle, and lean profile that skips scheduled ingest/Louvain unless GT_ANALYTICS_ACK_LOW_CPU=true. Backtest HUD removed from dashboard (OpenClaw/API regression only).

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 17:05:46 -06:00

29 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""GT feed adapter uses Telegram English translations for costly-signal matching."""
from __future__ import annotations
from analytics.feed_adapter import normalize_feed_item
def test_telegram_prefers_translated_text_for_gt() -> None:
post = {
"title": "Київ 1х БпЛА",
"description": "Обстріл біля Харкова",
"title_translated": "Kyiv 1x UAV",
"description_translated": "Shelling near Kharkiv with troop movement reported",
"source": "t.me/osintdefender",
"coords": [49.99, 36.23],
}
item = normalize_feed_item(post, source_type="telegram_osint")
assert "troop movement" in item["text"].lower()
assert item["domain"] == "conflict"
def test_hashtag_region_maps_ukraine_dossier_key() -> None:
post = {
"title": "Update",
"description_translated": "#Ukraine #USA aircraft spotted on runway",
"source": "t.me/osintdefender",
}
item = normalize_feed_item(post, source_type="telegram_osint")
assert item["region"] == "ukraine"