| Author | Dave Jarvis <email> |
|---|---|
| Date | 2021-06-02 22:49:39 GMT-0700 |
| Commit | 6880f3c036faf0ec33df7d9383e3495c3073c67e |
| Parent | f26ac0b |
| # 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 |
| 'Twas midnight | ||
| -\"Hello,\" said the spider. \"'Shelob' is my name.\" | ||
| +"Hello," said the spider. "'Shelob' is my name." | ||
| “Hello,” said the spider. “‘Shelob’ is my name.” | ||
| ‘He said, "I want to go."’ Were you alive in the 70's? | ||
| -\"That's a 'magic' sock.\" | ||
| -"That's a ‘magic’ sock." | ||
| +"That's a 'magic' sock." | ||
| +“That's a ‘magic’ sock.” | ||
| Website! Company Name, Inc. ("Company Name" or "Company") recommends reading the following terms and conditions, carefully: | ||
| Delta | 18 lines added, 5 lines removed, 13-line increase |
|---|