For a NLP-task I have several markdowns which store my training data.
##intent:greet
- Hi
- Hello
- Good Day
- Good Morning
- Good Evening
##intent:say_thank_you
- Thank you
- Thx
- awesome
- great
- thank you very much
I generate new training data while communicating with the bot. After loading, cleaning, etc. I will get a dict
.
{0 : {
'intent':'greet',
'data':'good day sir'
},
1 : {
'intent':'greet',
'data':'good afternoon'
},
2 : {
'intent':'say_thank_you',
'data':'good job
}
}
Now I want to append the sentences to my md file. I think the easiest way is directly after the ##intent:<intentname>
My first static approach was following:
intent = 'greet'
identifier = "##intent:"+intent
with open('<myPath.md>') as myfile:
if identifier in myfile.read():
print("found intent")
else:
print("no intent with name greet")
Although I have a valid md-File with an intent greet
I can´t find the line in the code. I assume I can´t search for markdown syntax in a file this way.
Is there a way to search for markdown in a md-File without changing the file? I noticed some suggestions to transform the file into HTML, but is there an easier way to do this?