def recommended_non_linear_math(NAVSTACK, STATE): try: feed_items, STATE = arxiv_api.get_feed(topic='nlin', STATE=STATE) print('-' * 80) print('generating recommendations. standby...') feed_items, STATE = main_ml.predict(feed_items, STATE=STATE) except: navigable_menus.error( 'request timed out or prediction algorithms have failed. standby...' ) articles = navigable_menus.make_articles(feed_items, sys.modules[__name__]) articles = navigable_menus.paginate(articles, page_length=10, menu_options=[ ('main_menu', 'back'), ('main_menu', 'back_to_main'), ('CONTROL', 'previous_page'), ('CONTROL', 'next_page') ]) action, STATE = navigable_menus.create( articles, header='main >> arxiv >> recommended >> non-linear math', STATE=STATE) return action, NAVSTACK, STATE
def new_cs(NAVSTACK, STATE): try: feed_items, STATE = arxiv_api.get_feed(topic='cs', STATE=STATE) except: navigable_menus.error('request timed out. standby...') return ('main_menu', 'do_nothing'), NAVSTACK, STATE articles = navigable_menus.make_articles(feed_items, sys.modules[__name__]) articles = navigable_menus.paginate(articles, page_length=10, menu_options=[ ('main_menu', 'back'), ('main_menu', 'back_to_main'), ('CONTROL', 'previous_page'), ('CONTROL', 'next_page') ]) action, STATE = navigable_menus.create( articles, header='main >> arxiv >> new articles >> cs', STATE=STATE) return action, NAVSTACK, STATE
def search(NAVSTACK, STATE): navigable_menus.make_header('main >> search') search_results, STATE = arxiv_api.search(STATE) if search_results == []: navigable_menus.error('no results found or query empty') return ('main_menu', 'back'), NAVSTACK, STATE articles = navigable_menus.make_articles(search_results, sys.modules[__name__]) articles = navigable_menus.paginate(articles, page_length=10, menu_options=[ ('main_menu', 'back'), ('main_menu', 'back_to_main'), ('CONTROL', 'previous_page'), ('CONTROL', 'next_page') ]) action, STATE = navigable_menus.create(articles, header='main >> search', STATE=STATE) return action, NAVSTACK, STATE