Format text is literal; class runs are {digits(n)} {upper(n)} {lower(n)}; a string is a format

This commit is contained in:
2026-09-02 12:37:21 +02:00
parent 99d8aa0fb7
commit ff4b243148
29 changed files with 308 additions and 267 deletions
+7 -7
View File
@@ -10,15 +10,15 @@
["Avenyn", "Birger Jarlsgatan", "Promenaden", "Staby", "Sveavägen", "Vintjärn"]
],
"street-number": [
{ "format": "1" },
{ "format": "10" },
{ "format": "100", "weight": 0.2 },
{ "format": "1A", "weight": 0.2 },
{ "format": "10A", "weight": 0.1 },
{ "format": "100A", "weight": 0.05 }
{ "format": "{int(1,9)}" },
{ "format": "{int(10,99)}" },
{ "format": "{int(100,999)}", "weight": 0.2 },
{ "format": "{int(1,9)}{upper(1)}", "weight": 0.2 },
{ "format": "{int(10,99)}{upper(1)}", "weight": 0.1 },
{ "format": "{int(100,999)}{upper(1)}", "weight": 0.05 }
],
"postal-code": [
{ "format": "100 10" }
{ "format": "{int(100,999)} {int(10,99)}" }
],
"locality": ["Alingsås", "Alvesta", "Ängelholm", "Arboga", "Arvika", "Avesta", "Boden", "Bollnäs", "Borås", "Borlänge", "Enköping", "Eskilstuna", "Eslöv", "Fagersta", "Falkenberg", "Falköping", "Falun", "Finspång", "Gällivare", "Gävle", "Göteborg", "Halmstad", "Haparanda", "Härnösand", "Hässleholm", "Helsingborg", "Huddinge", "Hudiksvall", "Jönköping", "Kalmar", "Karlshamn", "Karlskoga", "Karlskrona", "Karlstad", "Katrineholm", "Kiruna", "Köping", "Kramfors", "Kristianstad", "Kristinehamn", "Landskrona", "Lidingö", "Lidköping", "Lindesberg", "Linköping", "Ljungby", "Ludvika", "Luleå", "Lund", "Lycksele", "Malmö", "Mariestad", "Mjölby", "Mölndal", "Mora", "Motala", "Nacka", "Nässjö", "Norrköping", "Norrtälje", "Nyköping", "Nynäshamn", "Örebro", "Örnsköldsvik", "Oskarshamn", "Östersund", "Piteå", "Rabbalshede", "Ronneby", "Säffle", "Sandviken", "Sävsjö", "Sigtuna", "Skara", "Skellefteå", "Skövde", "Söderhamn", "Södertälje", "Sollentuna", "Solna", "Sölvesborg", "Stockholm", "Strängnäs", "Sundbyberg", "Sundsvall", "Täby", "Tierp", "Tranås", "Trelleborg", "Trollhättan", "Uddevalla", "Ulricehamn", "Umeå", "Upplands Väsby", "Uppsala", "Vänersborg", "Varberg", "Värnamo", "Västerås", "Västervik", "Växjö", "Vetlanda", "Vimmerby", "Visby", "Ystad"]
}
+1 -1
View File
@@ -1,6 +1,6 @@
[
{
"format": "##{x}{x}{x}{x}{x}{x}",
"format": "#{x}{x}{x}{x}{x}{x}",
"x": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],
"weight": 2
},
+6 -6
View File
@@ -4,12 +4,12 @@
"month": ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"],
"day": ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"],
"year": [
{ "format": "#1970" },
{ "format": "#1980" },
{ "format": "#1990", "weight": 2 },
{ "format": "2#0#00", "weight": 3 },
{ "format": "2#0#10", "weight": 3 },
{ "format": "2#020", "weight": 2 }
{ "format": "197{digits(1)}" },
{ "format": "198{digits(1)}" },
{ "format": "199{digits(1)}", "weight": 2 },
{ "format": "200{digits(1)}", "weight": 3 },
{ "format": "201{digits(1)}", "weight": 3 },
{ "format": "202{digits(1)}", "weight": 2 }
]
}
]
+1 -1
View File
@@ -2,7 +2,7 @@
{
"format": "{o}.{o}.{o}.{o}",
"weight": 8,
"o": [{ "format": "0", "weight": 3 }, { "format": "10", "weight": 4 }, { "format": "#100", "weight": 2 }]
"o": [{ "format": "{digits(1)}", "weight": 3 }, { "format": "{int(10,99)}", "weight": 4 }, { "format": "1{digits(2)}", "weight": 2 }]
},
{
"format": "{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}:{hex(4)}"
+6 -6
View File
@@ -3,15 +3,15 @@
"format": "{prefix}-{a} {b} {c}",
"weight": 10,
"prefix": ["070", "072", "073", "076", "079"],
"a": [{ "format": "000" }],
"b": [{ "format": "00" }],
"c": [{ "format": "00" }]
"a": [{ "format": "{digits(3)}" }],
"b": [{ "format": "{digits(2)}" }],
"c": [{ "format": "{digits(2)}" }]
},
{
"format": "{prefix}-{a} {b} {c}",
"prefix": ["08", "011", "013", "018", "019", "021", "023", "026", "031", "033", "035", "036", "040", "042", "044", "046", "054", "060", "063", "090"],
"a": [{ "format": "000" }],
"b": [{ "format": "00" }],
"c": [{ "format": "00" }]
"a": [{ "format": "{digits(3)}" }],
"b": [{ "format": "{digits(2)}" }],
"c": [{ "format": "{digits(2)}" }]
}
]
+6 -6
View File
@@ -2,12 +2,12 @@
{
"format": "{amt}{ore} kr",
"amt": [
{ "format": "1", "weight": 2 },
{ "format": "10", "weight": 4 },
{ "format": "100", "weight": 3 },
{ "format": "1 000", "weight": 1 },
{ "format": "10 000", "weight": 0.3 }
{ "format": "{int(1,9)}", "weight": 2 },
{ "format": "{int(10,99)}", "weight": 4 },
{ "format": "{int(100,999)}", "weight": 3 },
{ "format": "{int(1,9)} {digits(3)}", "weight": 1 },
{ "format": "{int(10,99)} {digits(3)}", "weight": 0.3 }
],
"ore": ["", { "format": ",{c}", "c": [{ "format": "00" }], "weight": 0.4 }]
"ore": ["", { "format": ",{c}", "c": [{ "format": "{digits(2)}" }], "weight": 0.4 }]
}
]
+1 -1
View File
@@ -1,6 +1,6 @@
[
{
"format": "00{mmdd}-000{luhn()}",
"format": "{digits(2)}{mmdd}-{digits(3)}{luhn()}",
"mmdd": [
{
"format": "{m}{d}",
+3 -3
View File
@@ -1,8 +1,8 @@
[
{
"format": "{hour}:{minute}{sec}",
"hour": [{ "format": "#00", "weight": 4 }, { "format": "#10", "weight": 4 }, { "format": "2{t}", "t": ["0", "1", "2", "3"], "weight": 2 }],
"minute": [{ "format": "{t}0", "t": ["0", "1", "2", "3", "4", "5"] }],
"sec": ["", { "format": ":{s}", "s": [{ "format": "{t}0", "t": ["0", "1", "2", "3", "4", "5"] }], "weight": 0.4 }]
"hour": [{ "format": "0{digits(1)}", "weight": 4 }, { "format": "1{digits(1)}", "weight": 4 }, { "format": "2{t}", "t": ["0", "1", "2", "3"], "weight": 2 }],
"minute": [{ "format": "{t}{digits(1)}", "t": ["0", "1", "2", "3", "4", "5"] }],
"sec": ["", { "format": ":{s}", "s": [{ "format": "{t}{digits(1)}", "t": ["0", "1", "2", "3", "4", "5"] }], "weight": 0.4 }]
}
]
+1 -1
View File
@@ -1,7 +1,7 @@
[
{
"format": "{pre}{n}.{n}.{n}{suffix}",
"n": [{ "format": "0", "weight": 3 }, { "format": "10" }],
"n": [{ "format": "{digits(1)}", "weight": 3 }, { "format": "{int(10,99)}" }],
"pre": ["", { "format": "v", "weight": 0.4 }],
"suffix": ["", { "format": "-{tag}.{m}", "tag": ["alpha", "beta", "rc"], "m": ["1", "2", "3"], "weight": 0.3 }]
}