Read the stations that never say a word
Most of what identifies itself on the air identifies itself in Morse. A repeater, a beacon, an unattended transmitter: four to six characters, over in a second or two, and no speech anywhere in the capture. Every one of those was being thrown away, in three separate places. The callsign book and the map were built inside the transcription branch, on the reasoning that callsigns come out of transcripts. They also come out of Morse and out of APRS headers, neither of which involves a speech recogniser -- so a receiver with none installed found none of them, and a CW ident reached the sidecar and stopped there. Both are now built whenever classification is on, and all three sources go through one place. The CW decoder only ran where the classifier had already said cw, ook or carrier. A two-second ident is a fraction of a capture named after whatever filled the rest of it. Every capture is offered to it now, once it has finished; a decode does not relabel a capture that plainly holds speech. And the decoder's own gates were written for a paragraph. Three characters, eight elements, and any repeated character refused -- which read VVV, DE, AR and K correctly and then discarded them. Short is the normal case now, on a second bar: perfect timing, nothing undecoded, and the keyed tone at least 20 dB over its band. That last is not decoration. With four elements the dot length is fitted to those very elements, so noise lands on the grid as neatly as keying does; a third of a second of white noise decodes as a perfectly timed V. Over 200 noise blocks the loudest bin never rose 13 dB above the median while keying at 3 dB SNR sits above 40. One keyed element is still refused: a single pulse is an E or a T whether a person sent it or the squelch opened on a click. 288 non-Morse cases, no false positives. Feeding that text to a callsign lookup made truncation matter. A capture opens when the squelch does, halfway through an element as often as not, and half a character is not a smaller reading -- a K missing its first dash is an A. So the sliced character is dropped, and so is the rest of its word, because what is left can read as a whole one: K1AA caught halfway through is K1A, which is somebody else. Across 1805 truncated captures that is 107 invented callsigns down to none, with 550 correct ones still found. Phonetics, which is the other half of the ask. A recogniser has never heard of the alphabet -- it writes what the words sounded like: Whiskey-One-Alpha-Whiskey hyphenated WhiskeyOneAlphaWhiskey run together Whiskey1AlphaWhiskey and half in digits wiskey one alfa whisky spelled the way it sounded whiskey one alpha, uh, whiskey with the hesitation written down All read back to W1AW now. A word is only taken apart when it is phonetic all the way through, which is what keeps it off "kilometre" and "victorious". Two bugs found on the way, both of which invented a callsign: - Nothing is joined across a slash any more. The beacon W1AW/B came back as W1AWB, which belongs to nobody, and W1AW-4 came back as nothing at all. - Nor across a gap the sender chose. A transcript's spacing is the recogniser's guess and may be closed up; a word gap in Morse is seven dot units, so "KU0W K" is a station signing off, not a longer callsign. Also here: - saunterbrowse gives Morse a panel of its own, with the licence under it, searchable with / and readable with t. - --simulate no longer looks anything up or writes a map. The demo band is invented but W1AW is the ARRL's own station, and it would have been pinned to the same map a real scan writes. - classify._psk_order took the logarithm of zero on a silent block. - The demo band has a repeater ident in it, and its Morse no longer runs one repeat into the next. - conftest refuses a real licence lookup from any test. 1161 tests, up from 1014. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PsWPTweCT6pwxKngvVxcg
This commit is contained in:
parent
f9f0d94000
commit
b4718aa425
21 changed files with 1434 additions and 129 deletions
|
|
@ -14,8 +14,9 @@ import time
|
|||
|
||||
import pytest
|
||||
|
||||
from bandsaunter.callsign import (Callsign, CallsignBook, HEADING,
|
||||
NOT_CALLSIGNS, SHAPE, describe_prefix,
|
||||
from bandsaunter.callsign import (Callsign, CallsignBook, FILLERS, HEADING,
|
||||
NOT_CALLSIGNS, PHONETIC, SHAPE,
|
||||
_phonetic_parts, describe_prefix,
|
||||
find_callsigns, person_case, report,
|
||||
split_postcode)
|
||||
|
||||
|
|
@ -124,6 +125,103 @@ def test_every_excluded_word_could_actually_have_matched():
|
|||
assert SHAPE.match(word), f"{word} never matched in the first place"
|
||||
|
||||
|
||||
# -- the phonetic alphabet, as a recogniser writes it down --------------------
|
||||
#
|
||||
# It is never written the way the ITU prints it. A recogniser hears the
|
||||
# words and writes what they sounded like, joins them up, hyphenates them, or
|
||||
# drops a hesitation in the middle of the run.
|
||||
|
||||
@pytest.mark.parametrize("text,want", [
|
||||
# Hyphenated, which is how a recogniser writes anything spelled out.
|
||||
("Whiskey-One-Alpha-Whiskey", ["W1AW"]),
|
||||
("this is whiskey-one-alpha-whiskey clear", ["W1AW"]),
|
||||
# Run together, when it was said quickly.
|
||||
("WhiskeyOneAlphaWhiskey", ["W1AW"]),
|
||||
("The station is Whiskey1AlphaWhiskey", ["W1AW"]),
|
||||
("kilouniformzerowhiskey", ["KU0W"]),
|
||||
# Said with a hesitation in the middle of it.
|
||||
("whiskey one alpha, uh, whiskey", ["W1AW"]),
|
||||
("kilo uniform um zero whiskey", ["KU0W"]),
|
||||
# The spellings that are not the official ones.
|
||||
("wiskey one alfa whisky", ["W1AW"]),
|
||||
("juliette alpha one november golf", ["JA1NG"]),
|
||||
("oskar viktor two charley romeo", ["OV2CR"]),
|
||||
])
|
||||
def test_a_phonetic_spelling_is_read_however_it_was_written(text, want):
|
||||
assert find_callsigns(text) == want
|
||||
|
||||
|
||||
@pytest.mark.parametrize("word", [
|
||||
"kilometre", "kilometer", "victorious", "november", "onetime", "papaya",
|
||||
"hotelier", "echoes", "deltas", "golfing", "oneself", "foxtrotting",
|
||||
"sierras", "alphabet", "zeroed", "information", "uniformity", "tangos",
|
||||
"twofold", "fivefold", "sixty", "seventeen", "nineteen", "charlies",
|
||||
"oscars", "limas", "romeos", "echoing", "novembers", "onto", "golfer",
|
||||
])
|
||||
def test_an_ordinary_word_is_not_taken_apart(word):
|
||||
"""Splitting only fires on a word that is phonetic all the way through.
|
||||
|
||||
A partial match is no match, which is the whole of what keeps this away
|
||||
from English: "kilometre" begins with a phonetic word and "victorious"
|
||||
contains one, and neither can be consumed to the end.
|
||||
"""
|
||||
assert _phonetic_parts(word) is None
|
||||
|
||||
|
||||
def test_x_ray_is_one_letter_not_two_words():
|
||||
"""The one phonetic word with a hyphen in it of its own."""
|
||||
assert find_callsigns("x-ray echo two delta") == ["XE2D"]
|
||||
assert find_callsigns("xray echo two delta") == ["XE2D"]
|
||||
|
||||
|
||||
def test_every_filler_is_something_a_recogniser_writes():
|
||||
"""Each of these has to be a word, not a letter it would swallow."""
|
||||
for word in FILLERS:
|
||||
assert word.lower() not in PHONETIC, word
|
||||
assert not SHAPE.match(word), word
|
||||
|
||||
|
||||
# -- suffixes, which are not part of the callsign ----------------------------
|
||||
|
||||
@pytest.mark.parametrize("text,want", [
|
||||
("W1AW/4", ["W1AW"]),
|
||||
("DL/W1AW", ["W1AW"]),
|
||||
("This is W1AW-4", ["W1AW"]),
|
||||
("VVV DE W1AW/B FN31", ["W1AW"]),
|
||||
("VE3XYZ/M mobile", ["VE3XYZ"]),
|
||||
])
|
||||
def test_a_suffix_is_not_glued_onto_the_callsign(text, want):
|
||||
"""A slash means "somewhere else", not another letter.
|
||||
|
||||
The beacon W1AW/B used to come back as W1AWB, which belongs to nobody
|
||||
and would have been looked up and pinned to a map.
|
||||
"""
|
||||
assert find_callsigns(text) == want
|
||||
|
||||
|
||||
# -- where the spacing is real ----------------------------------------------
|
||||
|
||||
def test_words_are_joined_where_a_recogniser_put_the_gaps_in():
|
||||
"""A transcript's spacing is a guess, so it is allowed to be wrong."""
|
||||
assert find_callsigns("KU 0W") == ["KU0W"]
|
||||
assert find_callsigns("K7 RA") == ["K7RA"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("text,want", [
|
||||
("KU0W K", ["KU0W"]), # a station signing off, not KU0WK
|
||||
("CQ CQ DE KU0W K", ["KU0W"]),
|
||||
("DE W1AW K", ["W1AW"]),
|
||||
("VVV DE W1AW/B FN31", ["W1AW"]),
|
||||
])
|
||||
def test_nothing_is_joined_where_the_sender_put_the_gaps_in(text, want):
|
||||
"""A word gap in Morse is seven dot units the sender chose to send.
|
||||
|
||||
Joining across one turns a station signing off with K -- "over" -- into a
|
||||
callsign one letter longer that belongs to somebody else entirely.
|
||||
"""
|
||||
assert find_callsigns(text, join_words=False) == want
|
||||
|
||||
|
||||
# -- what the callsign says about itself -------------------------------------
|
||||
|
||||
@pytest.mark.parametrize("call,country", [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue