Skip to content

Commit fab2427

Browse files
committed
Add ENGLISH_GBNF to llama_grammar.py
1 parent 250695f commit fab2427

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llama_cpp/llama_grammar.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ def from_json_schema(cls, json_schema: str, verbose: bool = True) -> "LlamaGramm
131131
ws ::= ([ \t\n] ws)?
132132
"""
133133

134+
ENGLISH_GBNF = r"""
135+
# note: this might be incomplete, mostly an example
136+
root ::= en-char+ ([ \t\n] en-char+)*
137+
en-char ::= letter | digit | punctuation
138+
letter ::= [a-zA-Z]
139+
digit ::= [0-9]
140+
punctuation ::= [!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]
141+
"""
142+
134143
JAPANESE_GBNF = r"""
135144
root ::= object
136145
value ::= object | array | string | number | ("true" | "false" | "null") ws

0 commit comments

Comments
 (0)