|
@@ -33,6 +33,7 @@ class EnDBlogTemplate(Template):
|
|
min_words=400,
|
|
min_words=400,
|
|
max_words=600):
|
|
max_words=600):
|
|
template_name = 'end_blog_template'
|
|
template_name = 'end_blog_template'
|
|
|
|
+ raise RuntimeError('Deprecated')
|
|
template_content = '''For context: You are writing a blog post for publication on the website of our company EnD UG.
|
|
template_content = '''For context: You are writing a blog post for publication on the website of our company EnD UG.
|
|
We specialize in tour planning software and are proud that our product is fast, reliable and easy to use.
|
|
We specialize in tour planning software and are proud that our product is fast, reliable and easy to use.
|
|
It allows our customers to plan the driving routes of their employees automatically while optimizing the driving time, fuel usage and timeliness.
|
|
It allows our customers to plan the driving routes of their employees automatically while optimizing the driving time, fuel usage and timeliness.
|
|
@@ -52,19 +53,23 @@ Do not include URLs, images or references to other blog posts.
|
|
class TechnicalBlogTemplate(Template):
|
|
class TechnicalBlogTemplate(Template):
|
|
def __init__(self,
|
|
def __init__(self,
|
|
min_words=400,
|
|
min_words=400,
|
|
- max_words=600):
|
|
|
|
|
|
+ max_words=600,
|
|
|
|
+ language='English'):
|
|
mean_words = (min_words + max_words) / 2
|
|
mean_words = (min_words + max_words) / 2
|
|
template_name = 'technical_blog_template'
|
|
template_name = 'technical_blog_template'
|
|
template_content = '''Please write a blog post about the topic of "{topic_name}" in a length of {min_words} to {max_words}, ideally around {mean_words}. {topic_detailed_description}
|
|
template_content = '''Please write a blog post about the topic of "{topic_name}" in a length of {min_words} to {max_words}, ideally around {mean_words}. {topic_detailed_description}
|
|
|
|
|
|
Make sure that the blog post is written in a way that is easy to understand, but technically detailed enough to show that the writer has expertise in the topic.
|
|
Make sure that the blog post is written in a way that is easy to understand, but technically detailed enough to show that the writer has expertise in the topic.
|
|
It should be written in an informative and factual way and not be promotional.
|
|
It should be written in an informative and factual way and not be promotional.
|
|
-Do not address the reader directly. Write in third person.
|
|
|
|
|
|
+Do not address the reader directly. Write in third person. Write in {language}.
|
|
Include a title and format the output as markdown. In particular, after each sentence, add a newline, and an additional one after paragraphs.
|
|
Include a title and format the output as markdown. In particular, after each sentence, add a newline, and an additional one after paragraphs.
|
|
Structure sections with headings.
|
|
Structure sections with headings.
|
|
Do not include URLs, images or references to other blog posts.
|
|
Do not include URLs, images or references to other blog posts.
|
|
'''
|
|
'''
|
|
- super().__init__(template_name, template_content, {'min_words': min_words, 'max_words': max_words, 'mean_words': mean_words})
|
|
|
|
|
|
+ super().__init__(template_name, template_content, {'min_words': min_words,
|
|
|
|
+ 'max_words': max_words,
|
|
|
|
+ 'mean_words': mean_words,
|
|
|
|
+ 'language': language})
|
|
|
|
|
|
|
|
|
|
class BlogCreator(EBC):
|
|
class BlogCreator(EBC):
|
|
@@ -93,6 +98,7 @@ class BlogCreator(EBC):
|
|
def to_disk(self):
|
|
def to_disk(self):
|
|
to_file = os.path.abspath(f'blog_posts/{topic.topic_name}_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.json')
|
|
to_file = os.path.abspath(f'blog_posts/{topic.topic_name}_{datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")}.json')
|
|
os.makedirs(os.path.dirname(to_file), exist_ok=True)
|
|
os.makedirs(os.path.dirname(to_file), exist_ok=True)
|
|
|
|
+ print(f'Requesting info for {to_file}...')
|
|
result = {'blogger': self.to_json(),
|
|
result = {'blogger': self.to_json(),
|
|
'dt_created': datetime.datetime.now().timestamp(),
|
|
'dt_created': datetime.datetime.now().timestamp(),
|
|
'request': self.request(),
|
|
'request': self.request(),
|
|
@@ -106,12 +112,12 @@ class BlogCreator(EBC):
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
topics = [
|
|
topics = [
|
|
- # Topic('Travel Salesman'),
|
|
|
|
- # Topic('k-opt Algorithm for the Traveling Salesman Problem'),
|
|
|
|
- # Topic('Linear Programming'),
|
|
|
|
- # Topic('Mixed Linear Programming'),
|
|
|
|
- # Topic('Clustering'),
|
|
|
|
- # Topic('OpenAPI and Swagger'),
|
|
|
|
|
|
+ # Topic('Problem des Handlungsreisenden (Traveling Salesperson)'),
|
|
|
|
+ # Topic('k-opt Algorithmus für das Traveling Salesperson Problem'),
|
|
|
|
+ # Topic('Lineare Programmierung'),
|
|
|
|
+ # Topic('Ganzzahlige lineare Optimierung'),
|
|
|
|
+ # Topic('Clustering', topic_detailed_description='Also mention that clustering can be used as a pre-processing step when solving the traveling salesperson problem.'),
|
|
|
|
+ # Topic('OpenAPI und Swagger'),
|
|
]
|
|
]
|
|
for topic in topics:
|
|
for topic in topics:
|
|
- BlogCreator(TechnicalBlogTemplate(), topic).to_disk()
|
|
|
|
|
|
+ BlogCreator(TechnicalBlogTemplate(language='German'), topic).to_disk()
|