Leanpub, 2023. — 120 p.
All examples in Hy. The Hy language (Lisp that compiles to Python) allows Lisp programmers access to the rich Python ecosystem for deep learning, artificial intelligence, and general data wrangling. Applications: OpenAI GPT, LangChain, Knowledge Graphs, NLP, Deep Learning.
Preface
Setting Up Your Development Environment
What is Lisp Programming Style?
Hy is Python, But With a Lisp Syntax
How This Book Reflects My Views on Artificial Intelligence and the Future of Society and Technology
About the Book Cover
A Request from the Author
Acknowledgements
Introduction to the Hy Language
We Will Often Use the Contributed let Macro in Book Example Code
Using Python Libraries
Global vs. Local Variables
Using Python Code in Hy Programs
Using Hy Libraries in Python Programs
Replacing the Python slice (cut) Notation with the Hy Functional Form
Iterating Through a List With Index of Each Element
Formatted Output
Importing Libraries from Different Directories on Your Laptop
Using Closures
Hy Looks Like Clojure: How Similar Are They?
Plotting Data Using the Numpy and the Matplotlib Libraries
Bonus Points: Configuration for macOS and ITerm2 for Generating Plots Inline in a Hy REPL and Shell
Why Lisp?
I Hated the Waterfall Method in the 1970s but Learned to Love a Bottom-Up Programming Style
First Introduction to Lisp
Commercial Product Development and Deployment Using Lisp
Hy Macros Let You Extend the Hy Language in Your Programs
Performing Bottom Up Development Inside a REPL is a Lifestyle Choice
Writing Web Applications
Getting Started With Flask: Using Python Decorators in Hy
Using Jinja2 Templates To Generate HTML
Handling HTTP Sessions and Cookies
Deploying Hy Language Flask Apps to Google Cloud Platform AppEngine
Deploying Hy Language Flask Apps to the Heroku Platform
Wrap-up
Responsible Web Scraping
Using the Python BeautifulSoup Library in the Hy Language
Getting HTML Links from the DemocracyNow.org News Web Site
Getting Summaries of Front Page from the NPR.org News Web Site
Using the Microsoft Bing Search APIs
Getting an Access Key for Microsoft Bing Search APIs
Example Search Script
Wrap-up
Deep Learning
Simple Multi-layer Perceptron Neural Networks
Deep Learning
Using Keras and TensorFlow to Model The Wisconsin Cancer Data Set
Using a LSTM Recurrent Neural Network to Generate English Text Similar to the Philosopher Nietzsche's writing
Natural Language Processing
Exploring the spaCy Library
Implementing a HyNLP Wrapper for the Python spaCy Library
Coreference (Anaphora Resolution)
Wrap-up
Datastores
Sqlite
PostgreSQL
RDF Data Using the ``rdflib'' Library
Wrap-up
Linked Data and the Semantic Web
Understanding the Resource Description Framework (RDF)
Resource Namespaces Provided in rdflib
Understanding the SPARQL Query Language
Wrapping the Python rdflib Library
Knowledge Graph Creator
Recommended Industrial Use of Knowledge Graphs
Design of KGCreator Application
Problems with using Literal Values in RDF
Revisiting This Example Using URIs Instead of Literal Values
Wrap-up
Knowledge Graph Navigator
Review of NLP Utilities Used in Application
Developing Low-Level Caching SPARQL Utilities
Utilities to Colorize SPARQL and Generated Output
Text Utilities for Queries and Results
Finishing the Main Function for KGN
Wrap-up
Book Wrap-up