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
+6 -6
View File
@@ -9,16 +9,16 @@
}
],
"street-number": [
{ "format": "10" },
{ "format": "100", "weight": 2 },
{ "format": "1000", "weight": 0.5 },
{ "format": "10100", "weight": 0.3 }
{ "format": "{int(10,99)}" },
{ "format": "{int(100,999)}", "weight": 2 },
{ "format": "{int(1000,9999)}", "weight": 0.5 },
{ "format": "{int(10,99)}{int(100,999)}", "weight": 0.3 }
],
"locality": ["Albany", "Atlanta", "Austin", "Baltimore", "Boston", "Charlotte", "Chicago", "Cincinnati", "Cleveland", "Columbus", "Dallas", "Denver", "Detroit", "El Paso", "Fort Worth", "Fresno", "Houston", "Indianapolis", "Jacksonville", "Kansas City", "Las Vegas", "Long Beach", "Los Angeles", "Memphis", "Mesa", "Miami", "Milwaukee", "Minneapolis", "Nashville", "New Orleans", "Oakland", "Oklahoma City", "Omaha", "Orlando", "Philadelphia", "Phoenix", "Pittsburgh", "Portland", "Raleigh", "Sacramento", "San Antonio", "San Diego", "San Jose", "Seattle", "St. Louis", "Tampa", "Tucson", "Tulsa"],
"region": ["AL", "AZ", "CA", "CO", "CT", "FL", "GA", "IL", "IN", "KY", "LA", "MA", "MD", "MI", "MN", "MO", "NC", "NJ", "NV", "NY", "OH", "OK", "OR", "PA", "TN", "TX", "VA", "WA", "WI"],
"postal-code": [
{ "format": "10000" },
{ "format": "10000-0000", "weight": 0.3 }
{ "format": "{int(10000,99999)}" },
{ "format": "{int(10000,99999)}-{digits(4)}", "weight": 0.3 }
]
}
]
+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)}"
+4 -4
View File
@@ -3,13 +3,13 @@
"format": "({area}) {exch}-{line}",
"weight": 2,
"area": ["202", "212", "213", "305", "312", "404", "415", "469", "503", "512", "602", "617", "646", "702", "718", "720", "737", "773", "786", "808", "917"],
"exch": [{ "format": "100" }],
"line": [{ "format": "0000" }]
"exch": [{ "format": "{int(100,999)}" }],
"line": [{ "format": "{digits(4)}" }]
},
{
"format": "{area}-{exch}-{line}",
"area": ["202", "212", "213", "305", "312", "404", "415", "469", "503", "512", "602", "617", "646", "702", "718", "720", "737", "773", "786", "808", "917"],
"exch": [{ "format": "100" }],
"line": [{ "format": "0000" }]
"exch": [{ "format": "{int(100,999)}" }],
"line": [{ "format": "{digits(4)}" }]
}
]
+7 -7
View File
@@ -2,15 +2,15 @@
{
"format": "${amt}.{cents}",
"amt": [
{ "format": "1", "weight": 2 },
{ "format": "10", "weight": 4 },
{ "format": "100", "weight": 3 },
{ "format": "1#,000", "weight": 1 },
{ "format": "10#,000", "weight": 0.4 },
{ "format": "100#,000", "weight": 0.1 }
{ "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.4 },
{ "format": "{int(100,999)},{digits(3)}", "weight": 0.1 }
],
"cents": [
{ "format": "00", "weight": 3 },
{ "format": "{digits(2)}", "weight": 3 },
"49",
"95",
"99"
+1 -1
View File
@@ -1,3 +1,3 @@
[
{ "format": "100-00-0000" }
{ "format": "{int(100,999)}-{digits(2)}-{digits(4)}" }
]
+1 -1
View File
@@ -2,7 +2,7 @@
{
"format": "{hour}:{minute} {ampm}",
"hour": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"],
"minute": [{ "format": "{t}0", "t": ["0", "1", "2", "3", "4", "5"] }],
"minute": [{ "format": "{t}{digits(1)}", "t": ["0", "1", "2", "3", "4", "5"] }],
"ampm": ["AM", "PM"]
}
]
+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 }]
}
+3 -3
View File
@@ -1,5 +1,5 @@
[
{ "format": "4{d}{luhn()}", "d": { "format": "0", "repeat": 14 }, "weight": 4 },
{ "format": "5{m}{d}{luhn()}", "m": ["1", "2", "3", "4", "5"], "d": { "format": "0", "repeat": 13 }, "weight": 3 },
{ "format": "3{m}{d}{luhn()}", "m": ["4", "7"], "d": { "format": "0", "repeat": 12 }, "weight": 1 }
{ "format": "4{d}{luhn()}", "d": { "format": "{digits(1)}", "repeat": 14 }, "weight": 4 },
{ "format": "5{m}{d}{luhn()}", "m": ["1", "2", "3", "4", "5"], "d": { "format": "{digits(1)}", "repeat": 13 }, "weight": 3 },
{ "format": "3{m}{d}{luhn()}", "m": ["4", "7"], "d": { "format": "{digits(1)}", "repeat": 12 }, "weight": 1 }
]
+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 }]
}