New Generator Formatting Available

JochenL

CL Byte Sprite
Staff member
CL Add-on Dev
Wizard of Adventure
Beta-Tester
JSON:
{
  "resultPattern": "{|do not display me\r\n|quiet} {|apple\r\n|indefinite} {|dice\r\n|indefinite}"
}
{|...|quiet} will not render the text
{|...|indefinite} will render the indefinite article a or an before the text
 

ELF

Generator Sage
Staff member
CL Add-on Dev
Beta-Tester
This is great, thank you! With this new functionality I can drop some kludges and call other generators more flexibly.

{|...|quiet} will not render the text
This is useful when you use other generators to produce some of the content used by the main generator. With the quiet option it is possible to just set the variables produced by the helper generator, but still produce direct output when you are using the helper generator directly. Previously you had to either use different entry points for these use cases or jump through hoops to be able to incorporate the helper generator results in the main generator.

{|...|indefinite} will render the indefinite article a or an before the text
Up until now, if I wanted to generate natural-sounding output, I needed to maintain a list of suitable attributes with the correct indefinite article included. And when I called a table, I had to prepend the table call with the attribute call to get the correct article in. This was mostly OK when the generator was used directly, but could become unwieldy when several generator calls were nested. What should have been simple details became convoluted lists of unnecessary adjectives.
 

Kathorus

New member
These are nice features.

There are some words in English that are spelled with consonants as the first letter but when spoken are pronounced with a vowel, likewise sometimes they are spelled with a vowel and pronounced with a consonant.

For instance;

hour, honest, honor should all be 'an'
unit, user, utility should all be 'a'

I'd be lying if I said I knew them all (and given country and regional differences there are likely exceptions within the exceptions), but perhaps functionality could be added for these exceptions and users could submit them as they're found.

As a start, this page has vowels pronounced as consonants. https://www.wordexample.com/list/words-beginning-vowel-no-an, I was unable to find a similar one with vowels.

There was also this stackoverflow question, and one guy downloaded wikipedia to come up with a javascript function.

https://stackoverflow.com/questions/1288291/how-can-i-correctly-prefix-a-word-with-a-and-an/1288473#1288473
 

JochenL

CL Byte Sprite
Staff member
CL Add-on Dev
Wizard of Adventure
Beta-Tester
At least the latter one was part of our review, but we decided to keep it simple as we want to provide a generator service and not a spelling/pronunciation service.

If someone wants to provide such a service I gladly call it to get a/an as detailed as possible.
 

ELF

Generator Sage
Staff member
CL Add-on Dev
Beta-Tester
This is not a trivial problem, with exceptions to exceptions, and would really require a largish dictionary. Perfection would of course be nice, but I think it's better to have something than nothing.

For adventurous minds, here's a sample implementation in several languages that at least sounds promising:
https://github.com/eamonnerbonne/a-vs-an
(This is the Wikipedia corpus based solution @Kathorus mentioned, also referenced in another Stackoverflow discussion.)
 
Top