mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-24 00:46:53 +01:00
Add roleplay.gbnf grammar (#5368)
This commit is contained in:
parent
b1463df0a1
commit
40c7977f9b
4
grammars/roleplay.gbnf
Normal file
4
grammars/roleplay.gbnf
Normal file
@ -0,0 +1,4 @@
|
||||
phrasePattern ::= "*" [A-ZÀ-Ü] ( [A-Za-z'.?!,:;-à-üÀ-Ü0-9]+ " " )* [A-Za-z'.?!,:;-à-üÀ-Ü0-9]+ "*"
|
||||
quotedText ::= "\"" [A-ZÀ-Ü] [A-Za-z'.*?!,:;-à-üÀ-Ü0-9]* (" " [A-Za-z'.*?!,:;-à-üÀ-Ü0-9]+)* "\""
|
||||
root ::= phrasePattern singleSpace quotedText singleSpace phrasePattern singleSpace quotedText singleSpace (phrasePattern singleSpace quotedText singleSpace)?
|
||||
singleSpace ::= " "
|
@ -115,6 +115,6 @@ def get_truncation_length():
|
||||
def load_grammar(name):
|
||||
p = Path(f'grammars/{name}')
|
||||
if p.exists():
|
||||
return open(p, 'r').read()
|
||||
return open(p, 'r', encoding='utf-8').read()
|
||||
else:
|
||||
return ''
|
||||
|
Loading…
Reference in New Issue
Block a user