ADRIAN VAZQUEZ ROMERO
ADRIAN VAZQUEZ ROMERO

Reputation: 43

special characters in yalm.dump python

I'm trying to save a file in yaml format with

with open('data.yml', 'w') as outfile:
   yaml.dump(data, outfile, default_flow_style=False)

with data, a dictionary with this format:

data={"## intent:greet": ["hi", "hello" ... "hola"], "## intent:goodbye": [...]}

in order to use it as nlu in a rasa development. The problem is that yalm.dump does not save the keys in an appropriate way because of the ## character. it saves the file as

'## intent:greet':
- hi
- hello

instead of

## intent:greet
- hi
- hello

What could be the way to solve the ' ' characters and delete the : in key (## intent:AAA) row??

Thanks

Upvotes: 0

Views: 177

Answers (1)

flyx
flyx

Reputation: 39738

You are trying to generate a Markdown file with a YAML processor. That isn't going to work.

Mind that Rasa 1.x used the Markdown format, which used ## intent:greet as heading, while Rasa 2.x uses a YAML format, which looks differently. You either use the 1.x Markdown format or YAML. You cannot generate the 1.x format with a YAML processor.

Upvotes: 1

Related Questions