Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenquotes.git

Add algorithm to documentation

AuthorDave Jarvis <email>
Date2021-06-02 22:49:39 GMT-0700
Commit6880f3c036faf0ec33df7d9383e3495c3073c67e
Parentf26ac0b
README.md
# KeenQuotes
-A lightweight natural language parser that converts straight quotes
-to curly quotes.
+A lightweight natural language parser for converting straight quotes
+into curly quotes.
+
+# Algorithm
+
+The overall algorithm follows:
+
+1. Run a lexer to produce relevant lexemes (e.g., words, numbers, and periods).
+1. Add lexemes to a 3-element circular queue, capturing either side of a
+straight quote.
+1. Tokenize all unambiguous single/double quotes, primes, and apostrophes.
+1. Resolve as many ambiguous quotation marks as possible.
+1. Emit unresolved conversions.
+
+See the Lexer and Parser classes for details.
# Build
lib/src/test/resources/com/keenwrite/quotes/smartypants.txt
&apos;Twas midnight
-\"Hello,\" said the spider. \"'Shelob' is my name.\"
+"Hello," said the spider. "'Shelob' is my name."
&ldquo;Hello,&rdquo; said the spider. &ldquo;&lsquo;Shelob&rsquo; is my name.&rdquo;
&lsquo;He said, "I want to go."&rsquo; Were you alive in the 70&apos;s?
-\"That's a 'magic' sock.\"
-"That&apos;s a &lsquo;magic&rsquo; sock."
+"That's a 'magic' sock."
+&ldquo;That&apos;s a &lsquo;magic&rsquo; sock.&rdquo;
Website! Company Name, Inc. ("Company Name" or "Company") recommends reading the following terms and conditions, carefully:
Delta18 lines added, 5 lines removed, 13-line increase