From 327053c9ab10b46854db095e757962de0298269d Mon Sep 17 00:00:00 2001 From: Colin Grambow Date: Thu, 4 Apr 2019 17:48:21 -0400 Subject: [PATCH 1/2] Print neural network quote at end of RMG job Use a text-generating neural network trained on a large corpus of quotes to generate completely novel quotes and print them at the end of RMG jobs. --- rmgpy/rmg/main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rmgpy/rmg/main.py b/rmgpy/rmg/main.py index 53eea950c3..a3710d3eb8 100644 --- a/rmgpy/rmg/main.py +++ b/rmgpy/rmg/main.py @@ -1363,6 +1363,21 @@ def finish(self): """ Complete the model generation. """ + # Print neural network-generated quote + import datetime + import textwrap + try: + from textgenrnn.quotes import get_quote + except ImportError: + pass + else: + quote = '"' + get_quote() + '"' + logging.info('') + logging.info(textwrap.fill(quote, subsequent_indent=' ')) + logging.info(' ---Quote-generating neural network, {}'.format( + datetime.datetime.now().strftime("%B %Y") + )) + # Log end timestamp logging.info('') logging.info('RMG execution terminated at ' + time.asctime()) From 1e178307e79d96b96746068beac238021aee95bd Mon Sep 17 00:00:00 2001 From: Colin Grambow Date: Thu, 4 Apr 2019 17:50:47 -0400 Subject: [PATCH 2/2] Update environment to include textgenrnn --- environment_linux.yml | 1 + environment_mac.yml | 1 + environment_windows.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/environment_linux.yml b/environment_linux.yml index 7d51a1e923..d64173d245 100644 --- a/environment_linux.yml +++ b/environment_linux.yml @@ -44,3 +44,4 @@ dependencies: - mpmath - dde - pyyaml + - textgenrnn diff --git a/environment_mac.yml b/environment_mac.yml index 728d5986fb..fca105d06a 100644 --- a/environment_mac.yml +++ b/environment_mac.yml @@ -43,3 +43,4 @@ dependencies: - mpmath - dde - pyyaml + - textgenrnn diff --git a/environment_windows.yml b/environment_windows.yml index 4507861f2f..0e0a8d84bf 100644 --- a/environment_windows.yml +++ b/environment_windows.yml @@ -42,3 +42,4 @@ dependencies: - mpmath - dde - pyyaml + - textgenrnn