| ▲ | wat10000 3 days ago | |||||||
Is there anything in the JSON grammer that only allows one valid option? In any case, I also don't understand why it would be costly. The fact that tokens are typically multiple characters would complicate things somewhat, but checking that a given token results in valid partial JSON doesn't seem too hard. | ||||||||
| ▲ | xg15 3 days ago | parent [-] | |||||||
Freeform JSON not so much I think, but if you combine it with a schema and strict whitespace/formatting rules, you could get quite a few. I think there are lots of boilerplate sequences like '":{' or '":[' or '", "', etc - though they might already be compressed into a single token if the tokenizer was trained on enough JSON. There are also situations where the schema would only allow a specific field name as the next token, e.g. if it was the only remaining valid and required field, or if fields have to be output in a specific order. | ||||||||
| ||||||||