Commit Graph

22 Commits

Author SHA1 Message Date
Zorchenhimer 1ac2863a43
Allow passing a format string to the generate command
The generate command now takes two optional arguments:

-c N
    Generate N number of sentences.

-f "some string"
    Use the given format string to generate sentences.
2021-02-21 20:37:15 -05:00
Zorchenhimer 71a0c01db9
Implement RNG format blocks in sentences
The RNG blocks follow a slightly different format than the word blocks.
They are wrapped in square brackets instead of curly braces.  The format
is as follows:

    [cmd:arguments]

`cmd` can be one of either "rng" or "hide".  "rng" takes a comma
separated list as its arguments and will choose one option from the
list.  Only raw words are accepted here (word blocks are not parsed).
"hide" will randomly hide its arguments in the output string.  The
arguments for this command *are* parsed, so {word} and {{new_word}}
blocks can be used.
2021-02-21 20:30:09 -05:00
Zorchenhimer 92e3a5aeb0
Randomize all the options if omitted
If an option for a pronoun, verb, noun, or noun_phrase is omitted it
will be randomized.
2021-02-21 20:07:42 -05:00
Zorchenhimer de79b26f57
Capitalize the pronoun "I" 2021-02-21 20:04:05 -05:00
Zorchenhimer 4298ee1e67
Fix parseNounOptions()
Set the proper variables for the "compound" and "simple" noun options.
2021-02-21 20:00:59 -05:00
Zorchenhimer 553b89cfe0
Implement consumeNewWord()
Implement the consumeNewWord() method that will handle new words defined
in format strings enclosed in double curly braces.  The format is as
follows:

    {{word_type:word:options,list}}

The notable difference between this and the other definitions is that
only verbs and nouns are allowed to be defined this way.  Additionally
only regular verbs and nouns are allowed (the "irregular" option is
ignored).

A new sentence has been added that utilizes this new function.

Lastly, some of the option parsing code for verbs and nouns has
been separated into their own functions so it can be reused between both
consumeWord() and consumeNewWord().
2021-02-20 21:35:26 -05:00
Zorchenhimer 59343064c6
Add note about irregular nouns not being implemented 2021-02-20 21:17:12 -05:00
Zorchenhimer 94a46a7072
Start implementing format sentences
Base word types are implemented.  The format for defining a word is as follows:

    {word_type:optionA,optionB}

Where `word_type` is one of the following:

    - adjective
    - noun
    - noun_phrase
    - pronoun
    - verb

Followed by a colon and a comma separated list of options for that word.
Options are as follows (adjectives have no options):

Nouns:
    - compound
    - plural

Noun Phrase:
    - indefinite
    - noadj
    - plural
    - compound

Pronouns:
    - plural

Verbs:
    - conjugation type: i (default), you, it, we, or they
    - conjugation time: past, present (default), or future
    - invert (not implemented yet)

Options for a word type are optional and may be omitted.
2021-02-17 18:07:23 -05:00
Zorchenhimer c376180b27
Rename generic.go to english.go
Grammar is probably different for different languages [citation needed].
2021-02-17 09:17:04 -05:00
Zorchenhimer ac4eefee22
Solidify sentence string format
"Convert" the currently implemented sentences into format strings.
These strings are not parsed yet.
2021-02-14 21:19:55 -05:00
Zorchenhimer 78b3b2313a
Fix not re-randomizing before a nounPhrase() call 2021-02-14 21:18:30 -05:00
Zorchenhimer 965a84725f
Add some more sentence types; Add pronouns
Added pronouns to the data.  These act similar to the other types of
words regarding getting random ones from the database.

More sentence types have been added, however they are all in their own
functions for now.  Eventually, these functions will be replaced by
format strings in the database and will not be hard coded.
2021-02-14 20:35:25 -05:00
Zorchenhimer 72298d6e8e
Implement generating compound nouns
Implemented generating compound nouns as well as filtering for the type
of noun when getting a list of noun IDs.
2021-02-14 18:33:13 -05:00
Zorchenhimer 8fd9d71625
Add toCap() to capitalize the first letter of a string 2021-02-14 18:31:56 -05:00
Zorchenhimer 9efa2cbe8c
Fix makefile 2021-02-14 18:25:42 -05:00
Zorchenhimer ef8f4176b1
Rename Random() to Hack() 2021-02-14 16:49:11 -05:00
Zorchenhimer abec5d2651
Added verb conjugation tests 2021-02-14 12:24:08 -05:00
Zorchenhimer 64b7ce434f Add verb conjugation
Added conjugation for verbs.  A single verb now gets appended onto a
noun phrase.
2021-02-13 20:22:55 -05:00
Zorchenhimer 32638d3b97 Add MIT license 2021-02-13 12:05:28 -05:00
Zorchenhimer 143712cffd Fix makefile
- Exclude files in cmd/ when looking for sources.
- Explicitly build cmd/server.go and cmd/generate.go separately.
- Add bin/generate recipe.
2021-02-13 12:02:41 -05:00
Zorchenhimer eeba54808b Reorganize things a bit
Removed the server object and moved the business layer into the main
namespace.  This turns the main namespace into a library instead of a
server implementation.  All of the http specific stuff (aside from
everything in frontend/) has been moved to the server commmand utility
in cmd/server.go.
2021-02-13 11:52:59 -05:00
Zorchenhimer 3d6c1a444f Initial commit
Main structure is mostly figured out.  Only a noun phrase is currently
generated.
2021-02-13 11:39:05 -05:00