The live TV view (F10) turns company names in headlines into tickers with live prices: "Nvidia" becomes NVDA. The hard part is refusing to do that when it would be wrong.
app/livetv.py holds an _AMBIGUOUS set of roots that must not match on plain text — words that are both a company name and ordinary English (open, data, block, match) and generic industry nouns that hide inside longer names (devices, systems, solutions). Without them:
- "he was open to a deal" tagged Opendoor
- "the obesity data" tagged Data I/O
- "Advanced Micro Devices" tagged 908 Devices instead of AMD
A cashtag always resolves, so $OPEN still works. Only bare prose is refused.
The task
The list is hand-written and certainly incomplete across 7,000 symbols. Find cases that still misfire and add them, with a test for each.
python tests/test_livetv.py # 37 assertions, most about what must NOT match
A good way to hunt: run the extractor over a few hundred real headlines from the news feed and eyeball what it tags.
from app import livetv, news
frame = ... # a derived snapshot
for item in news.feed(frame, limit=100)["items"]:
print(item["title"], "->", [h["symbol"] for h in livetv.mentioned(item["title"], frame)])
What good looks like
The bar is precision over recall. A missed mention is invisible; a wrong one is a rail confidently telling you a story about semiconductors is about a stock you have never heard of, and that is how a feature stops being trusted. If you are unsure, refuse the match.
If you find a whole category of failure rather than a few words — a naming pattern the root extractor mishandles — say so in the issue. That is worth more than a longer list, and _company_root is small enough to change.
The live TV view (
F10) turns company names in headlines into tickers with live prices: "Nvidia" becomes NVDA. The hard part is refusing to do that when it would be wrong.app/livetv.pyholds an_AMBIGUOUSset of roots that must not match on plain text — words that are both a company name and ordinary English (open,data,block,match) and generic industry nouns that hide inside longer names (devices,systems,solutions). Without them:A cashtag always resolves, so
$OPENstill works. Only bare prose is refused.The task
The list is hand-written and certainly incomplete across 7,000 symbols. Find cases that still misfire and add them, with a test for each.
python tests/test_livetv.py # 37 assertions, most about what must NOT matchA good way to hunt: run the extractor over a few hundred real headlines from the news feed and eyeball what it tags.
What good looks like
The bar is precision over recall. A missed mention is invisible; a wrong one is a rail confidently telling you a story about semiconductors is about a stock you have never heard of, and that is how a feature stops being trusted. If you are unsure, refuse the match.
If you find a whole category of failure rather than a few words — a naming pattern the root extractor mishandles — say so in the issue. That is worth more than a longer list, and
_company_rootis small enough to change.