This commit is contained in:
nik gaffney 2022-09-25 18:23:15 +02:00
commit ab6ace33c1
38 changed files with 20566 additions and 0 deletions

29
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,29 @@
on: [push, pull_request]
name: CI
jobs:
build:
name: "Build on Racket '${{ matrix.racket-version }}' (${{ matrix.racket-variant }})"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental || false }}
strategy:
fail-fast: false
matrix:
racket-version: ["stable", "current"]
racket-variant: ["BC", "CS"]
include:
- racket-version: current
experimental: true
steps:
- uses: actions/checkout@v2
- uses: Bogdanp/setup-racket@v1.7
with:
architecture: x64
distribution: full
variant: ${{ matrix.racket-variant }}
version: ${{ matrix.racket-version }}
- name: Installing MRG and its dependencies
run: raco pkg install --no-docs --auto --name MRG
- name: Compiling MRG and building its docs
run: raco setup --check-pkg-deps --unused-pkg-deps MRG
- name: Testing MRG
run: raco test -x -p MRG

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
*~
\#*
.\#*
.DS_Store
compiled/
/doc/

674
LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

137
README.org Normal file
View file

@ -0,0 +1,137 @@
# -*- mode: org; coding: utf-8; -*-
#+title: Moon Rat Gardener
MRG is a template based text generator closely following the [[https://perchance.org][perchance]] grammar and borrowing features (or non-features) from similar generators such as rant, tracery, lorem ipsum, dada engine etc. MRG aims to be simple to use and easy to read. Extensibility is possible but shouldnt be at the expense of readability or simplicity. Extraneous syntax is kept to a minimum.
Generators are usually built around substitution from lists (such as this example from the perchance documentation).
#+BEGIN_SRC text
output
Your [pack] contains [item], [item] and [item].
pack
purse
backpack
bag
pack
knapsack
rucksack
item
a few coins
an old {silver|bronze} ring
a handkerchief
a shard of bone
some lint
a tin of tea leaves
#+END_SRC
This template generates sentences like “Your purse contains some lint, a few coins and a handkerchief.” or “Your knapsack contains a few coins, a shard of bones and an old silver ring.”
* Writing templates
Templates are written in plain text with placeholders for text that can be replaced. They are usually based around lists of words or phrases. Special characters are limited to the square and curly brackets. i.e. “[ ]” and “{ }”. Some examples can be found in the [[file:data][data]] folder
The inclusion of a word in square brackets, like =[word]= will select something from the list called =word=. A list begins with a single word label and is followed by lines indented with 2 spaces.
Curly brackets can be used to indicate a choice, ={this|that|the other}= or a range of numbers ={1-101}= and can be used to generate the correct article or plural for a word using ={a}= or ={s}= (e.g. =fish{s}= generates “fishes” and =ox{s}= generates “oxen”)
There are a few modifier functions that can be used to filter the output such as =[word.modifier]= (e.g.. =[mouse.plural]= give “mice” or =[mouse.upcase]= gives “MOUSE”)
A template needs to include an =output= label with at least one item. An element is chosen randomly from the =output= list and used to generate a single output text.
#+BEGIN_SRC text
output
one word
#+END_SRC
The =output= items can select from a list like so…
#+BEGIN_SRC text
output
[word]
word
lonely
#+END_SRC
* Install
The package can be installed via the racket package manager
#+BEGIN_SRC shell :dir :wrap SRC text
racp pkg install moonrat
#+END_SRC
or installed manually from github
#+BEGIN_SRC shell :dir :wrap SRC text
git clone https://github.com/zzkt/moonrat
#+END_SRC
* Generate
Save a template in a file and run =moonrat= to generate text on the command line…
#+BEGIN_SRC shell :dir :wrap SRC text
raco moonrat data/music-genre.mg
#+END_SRC
further details…
#+BEGIN_SRC shell :dir :wrap SRC text
raco moonrat -h
#+END_SRC
or from a racket programme
#+BEGIN_SRC racket :lang racket :results output
#lang racket
(require moonrat)
(load-generator-file "music-genre.mg")
(generate)
#+END_SRC
* Moon Grade Ranter
[[https://tinysubversions.com/][Darius Kazemi]] has compiled a [[https://github.com/dariusk/corpora][collection of copora]] for “the creation of weird internet stuff” specifically for text generation. MRG includes a basic conversion utility to help use the corpora lists with moonrat. The converted lists are not validated in any way and will almost certainly need some manual coercion to be useful.
copora can be converted from a given url or file…
#+BEGIN_SRC shell :dir :wrap SRC text
raco cp2mg -u https://raw.githubusercontent.com/dariusk/corpora/master/data/colors/fictional.json
#+END_SRC
#+BEGIN_SRC shell :dir :wrap SRC text
raco cp2mg -f data/corpora/interjections.json -o data/interjections.mg
#+END_SRC
* Weird Machinery
The templates are almost certainly a weird machine capable of unexpected machinations using list substitution (well formed recursive lists) and choice (even without assignment). Implementation is left as an exercise for the reader (see also string rewriting and [[https://esolangs.org/wiki/Antigram][antigram]])
* Syntax, grammar and reference
- output
- a word
- a [word]
- {word|another word}
- {a} thing
- some thing{s}
- a [word.plural]
- [the four word title.title-case]
- a [nested.list.word]
- // comments are on a line by themselves (not yet inline)
(to be continued…)
* links & further
Included, precluded, transcluded and occluded…
- https://perchance.org/useful-generators
- https://perchance.org/generators
- https://github.com/rant-lang/rant
- https://dev.null.org/dadaengine/manual-1.0/dada_toc.html
- https://github.com/dariusk/corpora
- https://github.com/catseye/NaNoGenLab

967
data/adjective.mg Normal file
View file

@ -0,0 +1,967 @@
// description: English adjectives.
output
[adjective]
adjective
Aristotelian
Arthurian
Bohemian
Brethren
Mosaic
Oceanic
Proctor
Terran
Tudor
abroad
absorbing
abstract
academic
accelerated
accented
accountant
acquainted
acute
addicting
addictive
adjustable
admired
adult
adverse
advised
aerosol
afraid
aggravated
aggressive
agreeable
alienate
aligned
all-round
alleged
almond
alright
altruistic
ambient
ambivalent
amiable
amino
amorphous
amused
anatomical
ancestral
angelic
angrier
answerable
antiquarian
antiretroviral
appellate
applicable
apportioned
approachable
appropriated
archer
aroused
arrested
assertive
assigned
athletic
atrocious
attained
authoritarian
autobiographical
avaricious
avocado
awake
awsome
backstage
backwoods
balding
bandaged
banded
banned
barreled
battle
beaten
begotten
beguiled
bellied
belted
beneficent
besieged
betting
big-money
biggest
biochemical
bipolar
blackened
blame
blessed
blindfolded
bloat
blocked
blooded
blue-collar
blushing
boastful
bolder
bolstered
bonnie
bored
boundary
bounded
bounding
branched
brawling
brazen
breeding
bridged
brimming
brimstone
broadest
broiled
broker
bronze
bruising
buffy
bullied
bungling
burial
buttery
candied
canonical
cantankerous
cardinal
carefree
caretaker
casual
cathartic
causal
chapel
characterized
charcoal
cheeky
cherished
chipotle
chirping
chivalrous
circumstantial
civic
civil
civilised
clanking
clapping
claptrap
classless
cleansed
cleric
cloistered
codified
colloquial
colour
combat
combined
comely
commissioned
commonplace
commuter
commuting
comparable
complementary
compromising
conceding
concentrated
conceptual
conditioned
confederate
confident
confidential
confining
confuse
congressional
consequential
conservative
constituent
contaminated
contemporaneous
contraceptive
convertible
convex
cooked
coronary
corporatist
correlated
corroborated
cosmic
cover
crash
crypto
culminate
cushioned
dandy
dashing
dazzled
decreased
decrepit
dedicated
defaced
defective
defenseless
deluded
deodorant
departed
depress
designing
despairing
destitute
detective
determined
devastating
deviant
devilish
devoted
diagonal
dictated
didactic
differentiated
diffused
dirtier
disabling
disconnected
discovered
disdainful
diseased
disfigured
disheartened
disheveled
disillusioned
disparate
dissident
doable
doctrinal
doing
dotted
double-blind
downbeat
dozen
draining
draught
dread
dried
dropped
dulled
duplicate
eaten
echoing
economical
elaborated
elastic
elective
electoral
elven
embryo
emerald
emergency
emissary
emotional
employed
enamel
encased
encrusted
endangered
engraved
engrossing
enlarged
enlisted
enlivened
ensconced
entangled
enthralling
entire
envious
eradicated
eroded
esoteric
essential
evaporated
ever-present
evergreen
everlasting
exacting
exasperated
excess
exciting
executable
existent
exonerated
exorbitant
exponential
export
extraordinary
exultant
exulting
facsimile
fading
fainter
faith-based
fallacious
faltering
famous
fancier
fast-growing
fated
favourable
fearless
feathered
fellow
fermented
ferocious
fiddling
filling
firmer
fitted
flammable
flawed
fledgling
fleshy
flexible
flickering
floral
flowering
flowing
foggy
folic
foolhardy
foolish
footy
forehand
forked
formative
formulaic
foul-mouthed
fractional
fragrant
fraudulent
freakish
freckled
freelance
freight
fresh
fretted
frugal
fulfilling
fuming
funded
funny
garbled
gathered
geologic
geometric
gibberish
gilded
ginger
glare
glaring
gleaming
glorified
glorious
goalless
gold-plated
goody
grammatical
grande
grateful
gratuitous
graven
greener
grinding
grizzly
groaning
grudging
guaranteed
gusty
half-breed
hand-held
handheld
hands-off
hard-pressed
harlot
healing
healthier
healthiest
heart
heart-shaped
heathen
hedonistic
heralded
herbal
high-density
high-performance
high-res
high-yield
hissy
hitless
holiness
homesick
honorable
hooded
hopeless
horrendous
horrible
hot-button
huddled
human
humbling
humid
humiliating
hypnotized
idealistic
idiosyncratic
ignited
illustrated
illustrative
imitated
immense
immersive
immigrant
immoral
impassive
impressionable
improbable
impulsive
in-between
in-flight
inattentive
inbound
inbounds
incalculable
incomprehensible
indefatigable
indigo
indiscriminate
indomitable
inert
inflate
inform
inheriting
injured
injurious
inking
inoffensive
insane
insensible
insidious
insincere
insistent
insolent
insufferable
intemperate
interdependent
interesting
interfering
intern
interpreted
intersecting
intolerable
intolerant
intuitive
irresolute
irritate
jealous
jerking
joining
joint
journalistic
joyful
keyed
knowing
lacklustre
laden
lagging
lamented
laughable
layered
leather
leathern
leery
left-footed
legible
leisure
lessening
liberating
life-size
lifted
lightest
limitless
listening
literary
liver
livid
lobster
locked
long-held
long-lasting
long-running
long-suffering
loudest
loveliest
low-budget
low-carb
lowering
lucid
luckless
lusty
luxurious
magazine
maniac
manmade
maroon
mastered
mated
material
materialistic
meaningful
measuring
mediaeval
medical
meditated
medley
melodic
memorable
memorial
metabolic
metallic
metallurgical
metering
midair
midterm
midway
mighty
migrating
mind-blowing
mind-boggling
minor
mirrored
misguided
misshapen
mitigated
mixed
modernized
molecular
monarch
monastic
morbid
motley
motorized
mounted
multi-million
multidisciplinary
muscled
muscular
muted
mysterious
mythic
nail-biting
natural
nauseous
negative
networked
neurological
neutered
newest
night
nitrous
no-fly
noncommercial
nonsense
north
nuanced
occurring
offensive
oldest
oncoming
one-eyed
one-year
onstage
onward
opaque
open-ended
operating
opportunist
opposing
opt-in
ordinate
outdone
outlaw
outsized
overboard
overheated
oversize
overworked
oyster
paced
panting
paralyzed
paramount
parental
parted
partisan
passive
pastel
patriot
peacekeeping
pedestrian
peevish
penal
penned
pensive
perceptual
perky
permissible
pernicious
perpetuate
perplexed
pervasive
petrochemical
philosophical
picturesque
pillaged
piped
piquant
pitching
plausible
pliable
plumb
politician
polygamous
poorest
portmanteau
posed
positive
possible
postpartum
prank
pre-emptive
precocious
predicted
premium
preparatory
prerequisite
prescient
preserved
presidential
pressed
pressurized
presumed
prewar
priced
pricier
primal
primer
primetime
printed
private
problem
procedural
process
prodigious
professional
programmed
progressive
prolific
promising
promulgated
pronged
proportionate
protracted
pulled
pulsed
purgatory
quick
rapid-fire
raunchy
razed
reactive
readable
realizing
recognised
recovering
recurrent
recycled
redeemable
reflecting
regal
registering
reliable
reminiscent
remorseless
removable
renewable
repeating
repellent
reserve
resigned
respectful
rested
restrict
resultant
retaliatory
retiring
revelatory
reverend
reversing
revolving
ridiculous
right-hand
ringed
risque
robust
roomful
rotating
roused
rubber
run-down
running
runtime
rustling
safest
salient
sanctioned
saute
saved
scandalized
scarlet
scattering
sceptical
scheming
scoundrel
scratched
scratchy
scrolled
seated
second-best
segregated
self-taught
semiautomatic
senior
sensed
sentient
sexier
shadowy
shaken
shaker
shameless
shaped
shiny
shipped
shivering
shoestring
short
short-lived
signed
simplest
simplistic
sizable
skeleton
skinny
skirting
skyrocketed
slamming
slanting
slapstick
sleek
sleepless
sleepy
slender
slimmer
smacking
smokeless
smothered
smouldering
snuff
socialized
solid-state
sometime
sought
spanking
sparing
spattered
specialized
specific
speedy
spherical
spiky
spineless
sprung
squint
stainless
standing
starlight
startled
stately
statewide
stereoscopic
sticky
stimulant
stinky
stoked
stolen
storied
strained
strapping
strengthened
stubborn
stylized
suave
subjective
subjugated
subordinate
succeeding
suffering
summary
sunset
sunshine
supernatural
supervisory
supply-side
surrogate
suspended
suspenseful
swarthy
sweating
sweeping
swinging
swooning
sympathize
synchronized
synonymous
synthetic
tailed
tallest
tangible
tanked
tarry
technical
tectonic
telepathic
tenderest
territorial
testimonial
theistic
thicker
threatening
tight-lipped
timed
timely
timid
torrent
totalled
tougher
traditional
transformed
trapped
traveled
traverse
treated
trial
trunk
trusting
trying
twisted
two-lane
tyrannical
unaided
unassisted
unassuming
unattractive
uncapped
uncomfortable
uncontrolled
uncooked
uncooperative
underground
undersea
undisturbed
unearthly
uneasy
unequal
unfazed
unfinished
unforeseen
unforgivable
unidentified
unimaginative
uninspired
unintended
uninvited
universal
unmasked
unorthodox
unparalleled
unpleasant
unprincipled
unread
unreasonable
unregulated
unreliable
unremitting
unsafe
unsanitary
unsealed
unsuccessful
unsupervised
untimely
unwary
unwrapped
uppity
upstart
useless
utter
valiant
valid
valued
vanilla
vaulting
vaunted
veering
vegetative
vented
verbal
verifying
veritable
versed
vinyl
virgin
visceral
visual
voluptuous
walk-on
wanton
warlike
washed
waterproof
waved
weakest
well-bred
well-chosen
well-informed
wetting
wheeled
whirlwind
widen
widening
willful
willing
winnable
winningest
wireless
wistful
woeful
wooded
woodland
wordless
workable
worldly
worldwide
worst-case
worsted
worthless

332
data/adverb.mg Normal file
View file

@ -0,0 +1,332 @@
// description: English adverbs.
output
[adverb]
adverb
abnormally
absentmindedly
accidentally
acidly
actually
adventurously
afterwards
almost
always
angrily
annually
anxiously
arrogantly
awkwardly
badly
bashfully
beautifully
bitterly
bleakly
blindly
blissfully
boastfully
boldly
bravely
briefly
brightly
briskly
broadly
busily
calmly
carefully
carelessly
cautiously
certainly
cheerfully
clearly
cleverly
closely
coaxingly
colorfully
commonly
continually
coolly
correctly
courageously
crossly
cruelly
curiously
daily
daintily
dearly
deceivingly
deeply
defiantly
deliberately
delightfully
diligently
dimly
doubtfully
dreamily
easily
elegantly
energetically
enormously
enthusiastically
equally
especially
even
evenly
eventually
exactly
excitedly
extremely
fairly
faithfully
famously
far
fast
fatally
ferociously
fervently
fiercely
fondly
foolishly
fortunately
frankly
frantically
freely
frenetically
frightfully
fully
furiously
generally
generously
gently
gladly
gleefully
gracefully
gratefully
greatly
greedily
happily
hastily
healthily
heavily
helpfully
helplessly
highly
honestly
hopelessly
hourly
hungrily
immediately
innocently
inquisitively
instantly
intensely
intently
interestingly
inwardly
irritably
jaggedly
jealously
joshingly
jovially
joyfully
joyously
jubilantly
judgementally
justly
keenly
kiddingly
kindheartedly
kindly
kissingly
knavishly
knottily
knowingly
knowledgeably
kookily
lazily
less
lightly
likely
limply
lively
loftily
longingly
loosely
loudly
lovingly
loyally
madly
majestically
meaningfully
mechanically
merrily
miserably
mockingly
monthly
more
mortally
mostly
mysteriously
naturally
nearly
neatly
needily
nervously
never
nicely
noisily
not
obediently
obnoxiously
oddly
offensively
officially
often
only
openly
optimistically
overconfidently
owlishly
painfully
partially
patiently
perfectly
physically
playfully
politely
poorly
positively
potentially
powerfully
promptly
properly
punctually
quaintly
quarrelsomely
queasily
queerly
questionably
questioningly
quicker
quickly
quietly
quirkily
quizzically
rapidly
rarely
readily
really
reassuringly
recklessly
regularly
reluctantly
repeatedly
reproachfully
restfully
righteously
rightfully
rigidly
roughly
rudely
sadly
safely
scarcely
scarily
searchingly
sedately
seemingly
seldom
selfishly
separately
seriously
shakily
sharply
sheepishly
shrilly
shyly
silently
sleepily
slowly
smoothly
softly
solemnly
solidly
sometimes
soon
speedily
stealthily
sternly
strictly
successfully
suddenly
surprisingly
suspiciously
sweetly
swiftly
sympathetically
tenderly
tensely
terribly
thankfully
thoroughly
thoughtfully
tightly
tomorrow
too
tremendously
triumphantly
truly
truthfully
ultimately
unabashedly
unaccountably
unbearably
unethically
unexpectedly
unfortunately
unimpressively
unnaturally
unnecessarily
upbeat
upliftingly
upright
upside-down
upward
upwardly
urgently
usefully
uselessly
usually
utterly
vacantly
vaguely
vainly
valiantly
vastly
verbally
very
viciously
victoriously
violently
vivaciously
voluntarily
warmly
weakly
wearily
well
wetly
wholly
wildly
willfully
wisely
woefully
wonderfully
worriedly
wrongly
yawningly
yearly
yearningly
yesterday
yieldingly
youthfully

232
data/biological-diet.mg Normal file
View file

@ -0,0 +1,232 @@
// description: biological diets (herbivorous, carpophagous, etc.)
// source: http://phrontistery.info/feed.html
output
[diet]
diet
allotriophagy
// definition = craving for strange foods
androphagy
// definition = cannibalism
anthropophaginian
// definition = cannibal
anthropophagous
// definition = eating humans
aphagia
// definition = inability to eat or swallow
apivorous
// definition = eating bees
arachnivorous
// definition = feeding on spiders
autocoprophagy
// definition = eating one's own feces
autophagy
// definition = feeding on body's own tissues
baccivorous
// definition = eating berries
batrachivorous
// definition = frog-eating
bibliophagist
// definition = one who devours books, literally or figuratively
calcivorous
// definition = feeding on or living in limestone
cardophagus
// definition = donkey; something that eats thistles
carnivorous
// definition = eating flesh
carpophagous
// definition = fruit-eating
cepivorous
// definition = onion-eating
chthonophagia
// definition = eating dirt
comburivorous
// definition = consuming by fire
coprophagous
// definition = eating feces
creatophagous
// definition = carnivorous; flesh-eating
creophagous
// definition = flesh-eating; carnivorous
detritivore
// definition = animal that eats decomposing organic matter
dysphagia
// definition = pathological difficulty in swallowing
endophagy
// definition = cannibalism within a tribe; eating away from within
entomophagous
// definition = eating insects
equivorous
// definition = consuming horseflesh
exophagy
// definition = cannibalism outside one's own group
foliophagous
// definition = eating leaves; eating folios of books
formivorous
// definition = eating ants
fructivorous
// definition = feeding on fruit
frugivorous
// definition = eating fruit
fucivorous
// definition = eating seaweed
galactophagist
// definition = milk drinker
gamophagia
// definition = destruction of one gamete by another
geophagy
// definition = practice of feeding on soil; dirt-eating
glossophagine
// definition = eating using the tongue
graminivorous
// definition = feeding on grass or cereals
granivorous
// definition = feeding on seeds
gumnivorous
// definition = feeding on tree saps
herbivorous
// definition = eating only plant matter
hippophagy
// definition = feeding on horses
homnivorous
// definition = eating humans
hylophagous
// definition = eating wood
hyperphagia
// definition = eating too much
ichthyophagous
// definition = fish-eating
insectivorous
// definition = eating insects
kreatophagia
// definition = eating of raw meat
larvivorous
// definition = feeding on larvae
lignivorous
// definition = feeding on wood
limivorous
// definition = eating mud
lithophagous
// definition = stone-swallowing; rock-boring; eating rock
lotophagous
// definition = feeding on lotuses; indolent; lazy; dreamy
mallophagous
// definition = eating wool or fleece
meconophagist
// definition = consumer of opium or heroin
meliphagous
// definition = feeding upon honey
mellivorous
// definition = honey-eating
merdivorous
// definition = dung-eating
microphagous
// definition = feeding on small creatures or plants
monophagous
// definition = feeding on only one type of food
mucivorous
// definition = feeding on plant juices
mycophagous
// definition = eating fungus
myristicivorous
// definition = feeding upon nutmegs
myrmecophagous
// definition = feeding on ants
necrophagous
// definition = feeding on the dead
nectarivorous
// definition = feeding on nectar
nucivorous
// definition = nut-eating
omnivorous
// definition = eating anything; eating both plant and animal matter
omophagy
// definition = eating of raw flesh as a ritual observance
onychophagist
// definition = nail-biter
ophiophagous
// definition = eating snakes
oryzivorous
// definition = rice-eating
ossivorous
// definition = feeding on bones
ostreophagous
// definition = oyster-eating
ovivorous
// definition = eating eggs
ovivorous
// definition = eating sheep
paedophage
// definition = eater of children
pagophagia
// definition = eating trays of ice to help offset iron deficiency
panivorous
// definition = bread-eating
pantophagy
// definition = omnivorousness
phthirophagous
// definition = lice-eating
phyllophagous
// definition = leaf-eating
phytivorous
// definition = feeding on plants
phytophagous
// definition = feeding on vegetable matter
piscivorous
// definition = fish-eating
placentophagy
// definition = eating of the placenta
plantivorous
// definition = plant-eating
plasmophagous
// definition = consuming plasma
poephagous
// definition = eating grass or herbs; herbivorous
poltophagy
// definition = prolonged chewing of food
polyphagous
// definition = eating many types of food
psomophagy
// definition = swallowing food without thorough chewing
radicivorous
// definition = eating roots
ranivorous
// definition = eating frogs
rhizophagous
// definition = root-eating
rhypophagy
// definition = eating filth
sanguivorous
// definition = blood-drinking
saprophagous
// definition = feeding on decaying material
sarcophagous
// definition = feeding on flesh; carnivorous
saurophagous
// definition = eating lizards
scatophagous
// definition = dung-eating
seminivorous
// definition = seed-eating
stercovorous
// definition = feeding on dung or excrement
thalerophagous
// definition = feeding on fresh vegetable matter
theophagy
// definition = sacramental consumption of a god
toxicophagous
// definition = eating poison
toxiphagous
// definition = poison-eating
univorous
// definition = living on only one host or source of food
vegetivorous
// definition = eating vegetables
vermivorous
// definition = eating worms
xerophagy
// definition = eating of dry food; fast of dry food in the week preceding Easter
xylophagous
// definition = wood-eating
zoophagy
// definition = eating animals

92
data/clothing.mg Normal file
View file

@ -0,0 +1,92 @@
// description: List of clothing types
output
[clothing]
clothing
ball gown
belt
bikini
blazer
blouse
boots
bow tie
boxers
bra
briefs
camisole
cap
cardigan
cargos
catsuit
chemise
coat
corset
cravat
cufflinks
cummerbund
dinner jacket
dress
dressing gown
dungarees
fleece
gloves
hat
hoody
jacket
jeans
jogging suit
jumper
kaftan
kilt
knickers
kurta
lingerie
nightgown
nightwear
pants
pashmina
polo shirt
poncho
pyjamas
raincoat
robe
romper
sandals
sarong
scarf
shawl
shellsuit
shirt
shoes
shorts
skirt
slacks
slippers
socks
stockings
suit
sunglasses
sweater
sweatshirt
swimming {costume|shorts|trunks}
swimwear
t-shirt
tailcoat
tankini
thong
tie
tights
top
tracksuit
trainers
trousers
underclothes
underpants
undershirt
underwear
vest
vest underwear
waistcoat
waterproof
zip

83
data/cocktails.mg Normal file
View file

@ -0,0 +1,83 @@
// description: Cocktails recognized by the International Bartenders Association for use in the World Cocktail Competition.
output
[cocktail]
cocktail
Alexander
Americano
Angel Face
Aviation
Bacardi
Between the Sheets
Casino
Clover Club
Daiquiri
Derby
Dry Martini
Gin Fizz
John Collins
Manhattan
Mary Pickford
Monkey Gland
Negroni
Old Fashioned
Paradise
Planter's Punch
Porto flip
Ramos Gin Fizz
Rusty Nail
Sazerac
Screwdriver
Sidecar
Stinger
Tuxedo
Whiskey sour
White Lady
Bellini
Black Russian
Bloody Mary
Caipirinha
Champagne Cocktail
Cosmopolitan
Cuba Libre
French 75
French Connection
God Father
God Mother
Golden Dream
Grasshopper
Harvey Wallbanger
Hemingway Special
Horse's Neck
Irish Coffee
Kir
Long Island Iced Tea
Mai Tai
Margarita
Mimosa
Mint Julep
Mojito
Moscow Mule
Piña Colada
Rose
Sea-Breeze
Sex on the Beach
Singapore Sling
Tequila Sunrise
B-52
Barracuda
Bramble
Dark 'N' Stormy
Dirty Martini
Espresso Martini
French Martini
Kamikaze
Lemon Drop Martini
Pisco Sour
Russian Spring Punch
Spritz Veneziano
Tommy's Margarita
Vampiro
Vesper
Yellow Bird

1026
data/emoji.mg Normal file

File diff suppressed because it is too large Load diff

24
data/fast-food.mg Normal file
View file

@ -0,0 +1,24 @@
output
[fast-food]
fast-food
{chips|crisps}
{french|sweet potato} fries
potato wedges
burger
hamburger
cheeseburger
pizza
onion rings
burrito
nachos
taco
{dürüm|döner}
hot dog
doughnut
fish & chips
fried chicken
chicken nuggets
sandwich
ramen
{vanilla|chocolate|cookie dough|butter pecan|rocky road|mint chocolate chip|pistachio|strawberry|neapolitan|coffee|banana|caramel|lemon} {milkshake|ice cream}

1031
data/material.mg Normal file

File diff suppressed because it is too large Load diff

771
data/mood.mg Normal file
View file

@ -0,0 +1,771 @@
// description: A list of words that naturally complete the phrase 'They were feeling...'.
output
[mood]
mood
abandoned
absent minded
abused
accepted
accomplished
accusatory
accused
admired
adored
adrift
affectionate
afraid
aggravated
aggressive
agitated
alarmed
alert
alienated
alive
alluring
alone
aloof
amazed
ambushed
amused
angry
annoyed
antagonistic
anxious
apathetic
apologetic
appalled
appreciated
appreciative
apprehensive
aroused
ashamed
astonished
attacked
attractive
awake
aware
awe
awed
awestruck
awkward
bad
baffled
barren
bashful
beaten
belittled
benevolent
berated
betrayed
bewildered
bitchy
bitter
bittersweet
blah
blamed
blank
blissful
blue
bold
bored
bothered
bouncy
brave
broken
brooding
bummed
burdened
burned-out
callous
calm
capable
carefree
careless
caring
caustic
cautious
censored
centered
certain
challenged
charmed
cheated
cheerful
cherished
childish
chipper
choleric
clean
clear
clever
close
closed
clueless
clumsy
cold
comfortable
committed
compassionate
competent
competitive
complacent
complete
concerned
condemned
condescension
confident
confining
confused
considerate
contemplative
contempt
contemptuous
content
controlled
conventional
convicted
cornered
courageous
cowardly
cranky
crappy
crazy
critical
cross
crushed
curious
cynical
daring
dark
dashed
dazed
dead
deceived
dedicated
defeated
defenseless
defensive
defiant
degraded
dejected
delicate
delighted
demoralized
dependent
depressed
deprived
derisive
deserted
desired
desolate
despair
desperate
destroyed
detached
determined
devastated
devious
devoted
didactic
different
difficult
dignified
dirty
disappointed
disbelieving
discarded
disconnected
discontent
discontented
discouraged
disdainful
disgraced
disgusted
disheartened
dishonest
disillusioned
dismal
dismayed
disobedient
disorganized
disposable
distant
distracted
distressed
disturbed
ditzy
dorky
doubtful
down
drained
dreamy
dreary
dropped
drunk
dull
dumb
eager
earnest
ecstatic
edgy
effective
elated
embarassed
embarrassed
empathetic
empowered
empty
enchanted
encouraged
energetic
energized
enlightened
enraged
enriched
entertained
enthralled
enthusiastic
envious
erudite
evasive
evil
exasperated
excited
excluded
exhausted
exhilarated
expectant
exploited
exposed
exuberant
faithful
fake
fanciful
fantastic
fatalistic
fatigued
fearful
fearless
feisty
fine
flirty
flustered
foolish
foreboding
forgiven
forgiving
forgotten
forthright
fortunate
framed
frantic
free
friendly
frightened
frisky
frustrated
fulfilled
full
funny
furious
futile
geeky
generous
gentle
giddy
giggly
giving
glad
gloomy
glorious
good
grateful
great
grieving
groggy
grouchy
grumpy
guarded
guilty
gullible
handicapped
happy
harmonious
hateful
haughty
haunted
haunting
healthy
heard
heartbroken
heavy-hearted
helpful
helpless
hesitant
high
honored
hopeful
hopeless
horrible
horrified
hospitable
hostile
hot
humble
humiliated
hungry
hurt
hyper
hysterical
idealistic
idiotic
idyllic
ignorant
ignored
imaginative
immune
impatient
impelled
imperfect
impertinent
important
impressed
impulsive
inadequate
inattentive
incensed
inclusive
incompetent
incomplete
incredulous
indebted
indecisive
independent
indescribable
indifferent
indignant
industrious
inept
inferior
inflated
informed
infuriated
inhibited
innocent
innovative
inquisitive
insane
insecure
insensitive
insidious
insignificant
insulted
intense
interested
interrogated
interrupted
intimate
intimidated
intrigued
invigorated
invisible
involved
irate
irked
irrational
irresponsible
irritated
isolated
jaded
jealous
jinxed
jolly
jovial
joyful
joyous
jubilant
judged
judgmental
jumpy
just
justified
kidded
kind
knowledgeable
late
lazy
leery
left
let
lethargic
liable
liberated
liberating
lifeless
light-hearted
liked
listened
listless
logical
lonely
loose
lost
lousy
lovable
loved
loving
lucky
lyrical
mad
malicious
manipulated
matter
fact
mean
meditative
melancholic
melancholy
mellow
merciless
merry
mischievous
miserable
misinterpreted
mistreated
misunderstood
mixed
mocked
mocking
modest
molested
moody
morose
motivated
mournful
moved
mystified
naive
nasty
naughty
nauseated
needed
needy
negative
neglected
nerdy
nervous
neurotic
nightmarish
nonchalant
nostalgic
not
specified
noticed
numb
obeyed
objective
obligated
obvious
odd
offended
okay
old
open
oppressed
optimistic
ornery
control
outraged
overcome
overjoyed
overloaded
overwhelmed
overworked
owned
painful
pampered
panicky
paralyzed
passionate
passive
patient
patronizing
peaceful
peeved
pensive
perky
perplexed
persecuted
pessimistic
pestered
petrified
petty
phony
pious
pissed
off
playful
pleased
poor
positive
possessive
powerful
powerless
practical
predatory
pressured
private
productive
protected
protective
proud
provoked
prudish
punished
pushy
puzzled
questioned
quiet
quixotic
quizzical
rambunctious
realistic
reassured
rebellious
reborn
receptive
reckless
recognized
reconciled
recumbent
reflective
refreshed
regretful
rejected
rejuvenated
relaxed
released
relieved
reluctant
reminiscent
remorse
renewed
replaced
replenished
repressed
rescued
resentful
reserved
resistant
resourceful
respected
responsible
restless
restricted
revengeful
reverent
revitalized
ribald
rich
ridicule
ridiculous
right
rigid
robbed
romantic
rotten
rushed
sabotaged
sad
safe
sarcastic
sardonic
sassy
satiated
satiric
satisfied
saved
scared
scolded
scorned
secure
seductive
selfish
self-assured
self-centered
self-confident
self-conscious
self-destructive
self-reliant
sensitive
sentimental
serene
serious
sexy
shaken
shamed
sheepish
shocked
shunned
shy
sick
silenced
silly
sincere
sinful
skeptical
skillful
slandered
sleepy
sluggish
small
smart
smothered
solemn
somber
soothed
sorry
special
spiteful
splendid
spunky
squashed
stifled
stimulated
stingy
strained
stressed
stretched
strong
stubborn
stumped
stunned
stupid
submissive
successful
suffocated
suicidal
sullen
sunk
super
superior
supported
sure
surly
surprised
suspenseful
suspicious
sympathetic
tacky
tactful
talented
talkative
tame
tarnished
tasteful
tearful
teased
tenacious
tender
tense
tepid
terrible
terrific
terrified
terrifying
tested
testy
thankful
thoughtful
threatened
threatening
thrifty
thrilled
tired
tormented
torn
tortured
touched
tough
tragic
tranquil
transformed
trapped
treasured
trembly
tremendous
tricked
troubled
trusted
trustful
ugly
unaccepted
unappreciated
unbalanced
unburdened
uncanny
uncomfortable
unconcerned
uneven
unfit
unfriendly
united
unjust
unknown
unneeded
unpleasant
unreal
unruly
unwise
up
uplifted
used
useless
vacant
vague
vain
valid
valued
vengeful
vexed
vicious
victimized
victorious
violated
violent
vivacious
vivid
void
wacky
warlike
warm
warmhearted
warned
wary
wasted
weak
wealthy
weary
weird
welcoming
whimsical
whole
wild
willful
wishful
witty
worldly
worried
worse
worthy
wounded
wrong
yearning
yellow
yielding
young
youthful
zany
zealous

209
data/moon-name.mg Normal file
View file

@ -0,0 +1,209 @@
// description: Names of moons from the Sol solar system.
// source: https://github.com/dariusk/corpora/blob/master/data/science/planets.json
output
[moon]
moon
[Earth-moon]
[Mars-moon]
[Jupiter-moon]
[Saturn-moon]
[Uranus-moon]
[Neptune-moon]
[Pluto-moon]
[Haumea-Moon]
[Eris-moon]
Earth-moon
Moon
Mars-moon
Deimos
Phobos
Jupiter-moon
Metis
Adrastea
Amalthea
Thebe
Io
Europa
Ganymede
Callisto
Themisto
Leda
Himalia
Lysithea
Elara
S/2000 J11
S/2003 J12
Carpo
Euporie
S/2003 J3
S/2003 J18
Orthosie
Euanthe
Harpalyke
Praxidike
Thyone
S/2003 J16
Iocaste
Mneme
Hermippe
Thelxinoe
Helike
Ananke
S/2003 J15
Eurydome
Arche
Herse
Pasithee
S/2003 J10
Chaldene
Isonoe
Erinome
Kale
Aitne
Taygete
S/2003 J9
Carme
Sponde
Megaclite
S/2003 J5
S/2003 J19
S/2003 J23
Kalyke
Kore
Pasiphae
Eukelade
S/2003 J4
Sinope
Hegemone
Aoede
Kallichore
Autonoe
Callirrhoe
Cyllene
S/2003 J2
Saturn-moon
Tarqeq
Pan
Daphnis
Atlas
Prometheus
Pandora
Epimetheus
Janus
Aegaeon
Mimas
Methone
Anthe
Pallene
Enceladus
Tethys
Calypso
Telesto
Polydeuces
Dione
Helene
Rhea
Titan
Hyperion
Iapetus
Kiviuq
Ijiraq
Phoebe
Paaliaq
Skathi
Albiorix
S/2007 S2
Bebhionn
Erriapo
Siarnaq
Skoll
Tarvos
Greip
S/2004 S13
Hyrrokkin
Mundilfari
S/2006 S1
Jarnsaxa
Narvi
Bergelmir
S/2004 S17
Suttungr
Hati
S/2004 S12
Bestla
Farbauti
Thrymr
S/2007 S3
Aegir
S/2004 S7
S/2006 S3
Kari
Fenrir
Surtur
Ymir
Loge
Fornjot
Uranus-moon
Cordelia
Ophelia
Bianca
Cressida
Desdemona
Juliet
Portia
Rosalind
Cupid
Belinda
Perdita
Puck
Mab
Miranda
Ariel
Umbriel
Titania
Oberon
Francisco
Caliban
Stephano
Trinculo
Sycorax
Margaret
Prospero
Setebos
Ferdinand
Neptune-moon
Naiad
Thalassa
Despina
Galatea
Larissa
Proteus
Triton
Nereid
Halimede
Sao
Laomedeia
Psamathe
Neso
Pluto-moon
Charon
Styx
Nix
Kerberos
Hydra
Haumea-Moon
Namaka
Hi'iaka
Eris-moon
Dysnomia

1425
data/music-genre.mg Normal file

File diff suppressed because it is too large Load diff

79
data/norse-mythology.mg Normal file
View file

@ -0,0 +1,79 @@
// description: Gods and goddesses of norse and germanic myth
output
[norse-deity]
norse-deity
[norse-goddess]
[norse-god]
norse-goddess
Baduhenna
Bil
Beyla
Eir
Ēostre
Freyja
Frigg
Fulla
Gefjun
Gersemi
Gerðr
Gná
Gullveig
Hariasa
Hlín
Hretha
Hnoss
Ilmr
Iðunn
Irpa
Lofn
Nanna
Nerthus
Njörun
Rán
Rindr
Sága
Sandraudiga
Sif
Sigyn
Sinthgunt
Sjöfn
Skaði
Snotra
Sól
Syn
Tanfana
Þrúðr
Þorgerðr
Hölgabrúðr
Vár
Vör
Zisa
norse-god
Baldr
Bragi
Dellingr
Forseti
Freyr
Heimdallr
Hermóðr
Höðr
Hœnir
Lóðurr
Loki
Máni
Meili
Njörðr
Odin
Óðr
Saxnōt
Thor
Ullr
Váli
Viðarr
Vili

999
data/noun.mg Normal file
View file

@ -0,0 +1,999 @@
// description: A list of some English nouns.
output
[noun]
noun
Armour
Barrymore
Cabot
Catholicism
Chihuahua
Christianity
Easter
Frenchman
Lowry
Mayer
Orientalism
Pharaoh
Pueblo
Pullman
Rodeo
Saturday
Sister
Snead
Syrah
Tuesday
Woodward
abbey
absence
absorption
abstinence
absurdity
abundance
acceptance
accessibility
accommodation
accomplice
accountability
accounting
accreditation
accuracy
acquiescence
acreage
actress
actuality
adage
adaptation
adherence
adjustment
adoption
adultery
advancement
advert
advertisement
advertising
advice
aesthetics
affinity
aggression
agriculture
aircraft
airtime
allegation
allegiance
allegory
allergy
allies
alligator
allocation
allotment
altercation
ambulance
ammonia
anatomy
anemia
ankle
announcement
annoyance
annuity
anomaly
anthropology
anxiety
apartheid
apologise
apostle
apparatus
appeasement
appellation
appendix
applause
appointment
appraisal
archery
archipelago
architecture
ardor
arrears
arrow
artisan
artistry
ascent
assembly
assignment
association
asthma
atheism
attacker
attraction
attractiveness
auspices
authority
avarice
aversion
aviation
babbling
backlash
baker
ballet
balls
banjo
baron
barrier
barrister
bases
basin
basis
battery
battling
bedtime
beginner
begun
bending
bicycle
billing
bingo
biography
biology
birthplace
blackberry
blather
blossom
boardroom
boasting
bodyguard
boldness
bomber
bondage
bonding
bones
bonus
bookmark
boomer
booty
bounds
bowling
brainstorming
breadth
breaker
brewer
brightness
broccoli
broth
brotherhood
browsing
brunch
brunt
building
bullion
bureaucracy
burglary
buyout
by-election
cabal
cabbage
calamity
campaign
canonization
captaincy
carcass
carrier
cartridge
cassette
catfish
caught
celebrity
cemetery
certainty
certification
charade
chasm
check-in
cheerleader
cheesecake
chemotherapy
chili
china
chivalry
cholera
cilantro
circus
civilisation
civility
clearance
clearing
clerk
climber
closeness
clothing
clutches
coaster
coconut
coding
collaborator
colleague
college
collision
colors
combustion
comedian
comer
commander
commemoration
commenter
commissioner
commune
competition
completeness
complexity
computing
comrade
concur
condominium
conduit
confidant
configuration
confiscation
conflagration
conflict
consist
consistency
consolidation
conspiracy
constable
consul
consultancy
contentment
contents
contractor
conversation
cornerstone
corpus
correlation
councilman
counselor
countdown
countryman
coverage
covering
coyote
cracker
creator
criminality
crocodile
cropping
cross-examination
crossover
crossroads
culprit
cumin
curator
curfew
cursor
custard
cutter
cyclist
cyclone
cylinder
cynicism
daddy
damsel
darkness
dawning
daybreak
dealing
dedication
deduction
defection
deference
deficiency
definition
deflation
degeneration
delegation
delicacy
delirium
deliverance
demeanor
demon
demonstration
denomination
dentist
departure
depletion
depression
designation
despotism
detention
developer
devolution
dexterity
diagnosis
dialect
differentiation
digger
digress
dioxide
diploma
disability
disarmament
discord
discovery
dishonesty
dismissal
disobedience
dispatcher
disservice
distribution
distributor
diver
diversity
docking
dollar
dominance
domination
dominion
donkey
doorstep
doorway
dossier
downside
drafting
drank
drilling
driver
drumming
drunkenness
duchess
ducking
dugout
dumps
dwelling
dynamics
eagerness
earnestness
earnings
eater
editor
effectiveness
electricity
elements
eloquence
emancipation
embodiment
embroidery
emperor
employment
encampment
enclosure
encouragement
endangerment
enlightenment
enthusiasm
environment
environs
envoy
epilepsy
equation
equator
error
espionage
estimation
evacuation
exaggeration
examination
exclamation
expediency
exploitation
extinction
eyewitness
falls
fascism
fastball
feces
feedback
ferocity
fertilization
fetish
finale
firing
fixing
flashing
flask
flora
fluke
folklore
follower
foothold
footing
forefinger
forefront
forgiveness
formality
formation
formula
foyer
fragmentation
framework
fraud
freestyle
frequency
friendliness
fries
frigate
fulfillment
function
functionality
fundraiser
fusion
futility
gallantry
gallery
genesis
genitals
girlfriend
glamour
glitter
glucose
google
grandeur
grappling
greens
gridlock
grocer
groundwork
grouping
gunman
gusto
habitation
hacker
hallway
hamburger
hammock
handling
hands
handshake
happiness
hardship
headcount
header
headquarters
heads
headset
hearth
hearts
heath
hegemony
height
hello
helper
helping
helplessness
hierarchy
hoarding
hockey
homeland
homer
honesty
horror
horseman
hostility
housing
humility
hurricane
iceberg
ignition
illness
illustration
illustrator
immunity
immunization
imperialism
imprisonment
inaccuracy
inaction
inactivity
inauguration
indecency
indicator
inevitability
infamy
infiltration
influx
iniquity
innocence
innovation
insanity
inspiration
instruction
instructor
insurer
interact
intercession
intercourse
intermission
interpretation
intersection
interval
intolerance
intruder
invasion
investment
involvement
irrigation
iteration
jenny
jogging
jones
joseph
juggernaut
juncture
jurisprudence
juror
kangaroo
kingdom
knocking
laborer
larceny
laurels
layout
leadership
leasing
legislation
leopard
liberation
licence
lifeblood
lifeline
ligament
lighting
likeness
line-up
lineage
liner
lineup
liquidation
listener
literature
litigation
litre
loathing
locality
lodging
logic
longevity
lookout
lordship
lustre
ma'am
machinery
madness
magnificence
mahogany
mailing
mainframe
maintenance
majority
manga
mango
manifesto
mantra
manufacturer
maple
martin
martyrdom
mathematician
matrix
matron
mayhem
mayor
means
meantime
measurement
mechanics
mediator
medics
melodrama
memory
mentality
metaphysics
method
metre
miner
mirth
misconception
misery
mishap
misunderstanding
mobility
molasses
momentum
monarchy
monument
morale
mortality
motto
mouthful
mouthpiece
mover
movie
mowing
murderer
musician
mutation
mythology
narration
narrator
nationality
negligence
neighborhood
neighbour
nervousness
networking
nexus
nightmare
nobility
nobody
noodle
normalcy
notification
nourishment
novella
nucleus
nuisance
nursery
nutrition
nylon
oasis
obscenity
obscurity
observer
offense
onslaught
operation
opportunity
opposition
oracle
orchestra
organisation
organizer
orientation
originality
ounce
outage
outcome
outdoors
outfield
outing
outpost
outset
overseer
owner
oxygen
pairing
panther
paradox
parliament
parsley
parson
passenger
pasta
patchwork
pathos
patriotism
pendulum
penguin
permission
persona
perusal
pessimism
peter
philosopher
phosphorus
phrasing
physique
piles
plateau
playing
plaza
plethora
plurality
pneumonia
pointer
poker
policeman
polling
poster
posterity
posting
postponement
potassium
pottery
poultry
pounding
pragmatism
precedence
precinct
preoccupation
pretense
priesthood
prisoner
privacy
probation
proceeding
proceedings
processing
processor
progression
projection
prominence
propensity
prophecy
prorogation
prospectus
protein
prototype
providence
provider
provocation
proximity
puberty
publicist
publicity
publisher
pundit
putting
quantity
quart
quilting
quorum
racism
radiance
ralph
rancher
ranger
rapidity
rapport
ratification
rationality
reaction
reader
reassurance
rebirth
receptor
recipe
recognition
recourse
recreation
rector
recurrence
redemption
redistribution
redundancy
refinery
reformer
refrigerator
regularity
regulator
reinforcement
reins
reinstatement
relativism
relaxation
rendition
repayment
repentance
repertoire
repository
republic
reputation
resentment
residency
resignation
restaurant
resurgence
retailer
retention
retirement
reviewer
riches
righteousness
roadblock
robber
rocks
rubbing
runoff
saloon
salvation
sarcasm
saucer
savior
scarcity
scenario
scenery
schism
scholarship
schoolboy
schooner
scissors
scolding
scooter
scouring
scrimmage
scrum
seating
sediment
seduction
seeder
seizure
self-confidence
self-control
self-respect
semicolon
semiconductor
semifinal
senator
sending
serenity
seriousness
servitude
sesame
setup
sewing
sharpness
shaving
shoplifting
shopping
siding
simplicity
simulation
sinking
skate
sloth
slugger
snack
snail
snapshot
snark
soccer
solemnity
solicitation
solitude
somewhere
sophistication
sorcery
souvenir
spaghetti
specification
specimen
specs
spectacle
spectre
speculation
sperm
spoiler
squad
squid
staging
stagnation
staircase
stairway
stamina
standpoint
standstill
stanza
statement
stillness
stimulus
stocks
stole
stoppage
storey
storyteller
stylus
subcommittee
subscription
subsidy
suburb
success
sufferer
supposition
suspension
sweater
sweepstakes
swimmer
syndrome
synopsis
syntax
system
tablespoon
taker
tavern
technology
telephony
template
tempo
tendency
tendon
terrier
terror
terry
theater
theology
therapy
thicket
thoroughfare
threshold
thriller
thunderstorm
ticker
tiger
tights
to-day
tossing
touchdown
tourist
tourney
toxicity
tracing
tractor
translation
transmission
transmitter
trauma
traveler
treadmill
trilogy
trout
tuning
twenties
tycoon
tyrant
ultimatum
underdog
underwear
unhappiness
unification
university
uprising
vaccination
validity
vampire
vanguard
variation
vegetation
verification
viability
vicinity
victory
viewpoint
villa
vindication
violation
vista
vocalist
vogue
volcano
voltage
vomiting
vulnerability
waistcoat
waitress
wardrobe
warmth
watchdog
wealth
weariness
whereabouts
whisky
whiteness
widget
width
windfall
wiring
witchcraft
withholding
womanhood
words
workman
youngster

51
data/ominous-wooshing.mg Normal file
View file

@ -0,0 +1,51 @@
// description: Closed-captioned Sounds From Twin Peaks: The Return (Part 8)
output
[ominous-wooshing]
ominous-wooshing
revolver clicks
gunshots echo
ominous atmospheric music
ominous atmospheric music builds
distorted moaning
distorted moaning intensifies
ominous whooshing
discordant instrumentation
atmospheric wind
intense atmospheric whooshing
boom
explosions booming
explosions rumbling
static sputtering
warbling static sputtering
brooding atmospheric music
static sputtering continues
electrical scratching
otherworldly exhaling
intense discordant music
atmospheric rumbling
wind whooshing
atmospheric whooshing
ambient vintage music playing over gramophone
distant music
alarming metallic clanking
footsteps oddly reverberating
eerie atmospheric music
ominous atmospheric music
serene atmospheric music
atmospheric hum
atmospheric wind
crinkling, squishing
crickets chirping
engine revving
ominous scratching noise
distorted wail
distorted scream
blood dripping
splat
whimpering
soft groaning
radio static humming
radio static crackling softly
distant rumbling

9314
data/personal-noun.mg Normal file

File diff suppressed because it is too large Load diff

554
data/symptom.mg Normal file
View file

@ -0,0 +1,554 @@
// description: Disease symptoms. From the OBO Symptom Ontology
// source: https://github.com/DiseaseOntology/SymptomOntology
output
[symptom]
symptom
Pel-Epstein fever
abdominal pain
abnormal behavior
abnormal feces
abnormal hemistanding
abnormal hemiwalking
abnormal hemiwalking hemistanding
abnormal sputum
abnormal weight gain
absence of knee jerk reflex
absence seizure
absent gag reflex
active hyperemia
acute arthritis
acute cranial nerve dysfunction
acute diarrhea
acute dyspnea
acute enteritis
acute gastroenteritis
acute meningoencephalitis
acute mesenteric lymphadenitis
acute pain
acute painful vision loss
acute renal failure
acute suppurative parotiditis
acute weight loss
adenopathy
afebrile
aggressive behavior
agraphia
alexia
allodynia
amaurosis
amaurosis fugax
anaphylactic shock
anasarca
anisocoria
ankle rash
anomia
aphonia
apnea
areflexia
arm weakness
asthenopia
atonic seizure
atrial fibrillation
backache
bifrontal headache
blindness
bloodshot eye
bloody sputum
bloody stool
blotchy red rash
body ache
bradycardia
bradykinesia
bradypnea
breakthrough pain
breathing problems
bronchopneumonia
bubo
cardiac fibrillation
cardiogenic shock
cataplexy
cervical edema
cervical lymphadenopathy
chest pain
cheyne-stokes respiration
chronic cough
chronic enteritis
chronic fatigue syndrome
chronic pain
circling movement
claudication
clonic seizure
cloudy cornea
coagulopathy
colic
colicky pain
coma
communication difficulty
complex partial seizure
congested sclera
conjunctivitis
conscious disturbance
conscious proprioception
constipation
continuous fever
continuous leakage of urine
continuous profuse salivation
contracted pupil
cornea symptom
corneal opacity
corneal ulcers
cough with bloody sputum
cranial nerve palsies
cyclic fever
cytopenia
deafness
decreased appetite
decreased conscious proprioception
decreased flexor withdrawal reflex
decreased pharyngeal tone
decreased sucking
decreased tongue tone
delayed milestones
deltoid muscle weakness
diaphoresis
diarrhea
diffuse rash
diminished gag reflex
disorientation
disruptions of 24-hour sleep-wake cycle
disturbed vision
double vision
droopy ears
dry cough
dry hacking cough
dry mouth
dysfunctions associated with arousal from sleep
dysfunctions associated with sleep stages
dyspareunia
dysphagia
dysphonia
dyspnea
ear symptom
earache
elbow pain
emaciation
enlargement of lymph nodes
epigastric abdominal lump
epigastric abdominal mass
epigastric abdominal pain
epigastric abdominal rigidity
epigastric abdominal swelling
epigastric abdominal tenderness
epigastric pelvic lump
epigastric pelvic mass
epigastric pelvic swelling
epileptic seizure
epistaxis
exanthema
excess lymphocytes in cerebrospinal fluid
excess salivation
excessive crying
excessive tearing
exhaustion
exophthalmos
expressive aphasia
extensive ulcer
extraocular muscles paralysis
extreme exhaustion
extreme fatigue
extreme prostration
eye discharge
eye strain
face hyperemia
facial edema
facial muscle twitching
facial paralysis
facial tremor
facial weakness
failure to thrive
faint
febrile convulsion
fixed dilated pupils
fixed pupil
flaccid muscle tone
flaccid paralysis
focal seizure
freezing hypokinesia
frontal headache
functional hyperemia
fussy
gas pain
generalized abdominal lump
generalized abdominal mass
generalized abdominal pain
generalized abdominal rigidity
generalized abdominal swelling
generalized abdominal tenderness
generalized pelvic lump
generalized pelvic mass
generalized pelvic swelling
generalized seizure
granulomatous inflammation
gross hematuria
gum bleeding
head pressing
head swelling
headache
heartburn
hematemesis
hematochezia
hematogenous
hemiparesis
hemodynamic instability
hemolysis
hemolytic anemia
hemorrhage from throat
hemorrhagic diarrhea
hemorrhagic gastroenteritis
hepatic abscess
hepatic dysfunction
hepatic necrosis
hepatitis
hepatomegaly
hepatosplenomegaly
herpetic lesion on upper lip
high fever
hilar lymphadenitis
hind limb paralysis
hip pain
hoarse voice
hoarseness
hopping
hydrocephalus
hyperactivity
hyperalgesia
hyperemia
hyperemia of the neck
hyperesthesia
hypermenorrhea
hyperpyrexia
hyperreflexia
hypersomnia
hypersomnia with sleep apnea
hyperthermia
hyperventilation
hypoalgesia
hypoesthesia
hyponatremia
hypopyon
hypotension
hypotensive
hypoventilation
hypoxemia
icteric eyes
impaired coordination
impaired gag reflex
inability to comprehend speech
inability to concentrate
inability to feed
inability to form words
inability to speak
inability to swallow
inability to think clearly
incomplete bladder emptying
incontinence without sensory awareness
incoordination
increased appetite
inflamed eyes
inflammatory low back pain
inibility to stand
insomnia
insomnia with sleep apnea
intense anxiety
intense toxemia
intraretinal hemorrhage
irritability
ischemia
ischemic necrosis of jejunum
joint inflammation
joint pain
junctional tachycardia
keratitis
knee pain
lack of coordination
lack of normal physiological development
laryngitis
laryngotracheitis
lateroventral deviation of the head
left lower quadrant abdominal lump
left lower quadrant abdominal mass
left lower quadrant abdominal pain
left lower quadrant abdominal rigidity
left lower quadrant abdominal swelling
left lower quadrant abdominal tenderness
left lower quadrant pelvic lump
left lower quadrant pelvic mass
left lower quadrant pelvic swelling
left upper quadrant abdominal lump
left upper quadrant abdominal mass
left upper quadrant abdominal pain
left upper quadrant abdominal rigidity
left upper quadrant abdominal swelling
left upper quadrant abdominal tenderness
left upper quadrant pelvic lump
left upper quadrant pelvic mass
left upper quadrant pelvic swelling
leg cramp
leg swelling
leg weakness
lesions in mouth
lesions in oropharynx
lethargy
leukocytosis
leukopenia
light sensitivity
limb edema
limb weakness
limited attention
lip paralysis
liver inflammation
loss of appetite
loss of tendon reflex
loss of weight
low backache
low-grade fever
lymph gland swelling
lymphadenitis
lymphangitis
lymphoblastoma
lymphopenia
macrocytosis
maculopapular rash
male stress incontinence
massive hepatic necrosis
melena
metrorrhagia
microangiopathic hemolytic anemia
microangiopathy
mild bronchitis
mild conjunctivitis
mild encephalitis
mild fever
mild hypotension
mild tetanic convulsion
miosis
mixed incontinence (female) (male)
moderate anemia
moderate conjuctival injection
motor paralysis
mouth bleeding
mouth papules
mouth sore
multiple abscesses
multiple sites abdominal lump
multiple sites abdominal mass
multiple sites abdominal pain
multiple sites abdominal rigidity
multiple sites abdominal swelling
multiple sites abdominal tenderness
multiple sites pelvic lump
multiple sites pelvic mass
multiple sites pelvic swelling
muscle cramp
muscle necrosis
muscle pain
muscle soreness
muscle tenderness
muscle tightness
muscle twitching
muscles ache
mydriasis
myoclonic seizure
nasal bleeding
nasal congestion
nasal discharge
neck pain
neck weakness
neuropathic pain
night sweats
nociceptive pain
nocturnal enuresis
nose symptom
nystagmus
objective vertigo
obsessive interests
occasional diplopia
ocular lesion
ophthalmoplegia
opisthotonus
orthopnea
otitis
overflow incontinence
painful lymph glands
painful reginal lymphadenopathy
palate weakness
palpebral edema
panting respiration
papular rash
paraplegia
pareses
parotid abscess
parotid pain
paroxysmal tachycardia
partial hind limb paralysis
pelvic lump
pelvic mass
pelvic swelling
peripheral muscle weakness
periumbilic abdominal lump
periumbilic abdominal mass
periumbilic abdominal pain
periumbilic abdominal rigidity
periumbilic abdominal swelling
periumbilic abdominal tenderness
periumbilic pelvic lump
periumbilic pelvic mass
periumbilic pelvic swelling
persistent vegetative state
phantom pain
pharyngitis
photophobia
plasmacytosis
pleuritic chest pain
pneumonia
poor enunciation
poor feeding
post-void dribbling
postural instability hypokinesia
precordial pain
profound weakness
progressive emaciation
progressive prostration
progressive weakness
prolonged fever
prostatic abscess
prostatic infection
proximal paralysis of arm and leg
purpuric rash
rales
reactive hyperemia
receptive aphasia
referred pain
relapsing fever
remittent fever
renal colic
repetitive behavior
respiratory paralysis
reticulocytosis
retrobulbar pain
rhinitis
right lower quadrant abdominal lump
right lower quadrant abdominal mass
right lower quadrant abdominal pain
right lower quadrant abdominal rigidity
right lower quadrant abdominal swelling
right lower quadrant abdominal tenderness
right lower quadrant pelvic lump
right lower quadrant pelvic mass
right lower quadrant pelvic swelling
right upper quadrant abdominal lump
right upper quadrant abdominal mass
right upper quadrant abdominal pain
right upper quadrant abdominal rigidity
right upper quadrant abdominal swelling
right upper quadrant abdominal tenderness
right upper quadrant pelvic lump
right upper quadrant pelvic mass
right upper quadrant pelvic swelling
rigidity hypokinesia
runny nose
salivation
septic shock
septicemia
severe abdominal cramp
severe backache
severe chest pain
severe conjunctivitis
severe diarrhea
severe headache
severe joint pain
severe mastitis
severe myalgia
severe necrosis
severe pneumonia
short stature
shoulder pain
simple partial seizure
sinus bradycardia
sinus tachycardia
sinusitis
skin ulcer
sleep apnea
sleep related movement disorder
slowing of urinary stream
slurred speech
sore eyes
spastic paralysis
spleen abscess
spleen symptom
splenomegaly
splitting of urinary stream
spontaneous abortion
steatorrhea
sternocleidomastoid weakness
stiff neck
stress incontinence
stupor
subconjunctival bleeding
subjective vertigo
sudden ataxis
sudden onset of fever
suppurative pneumonia
syncope
syncope and collapse
synovitis
tache noire
tachycardia
tachypnea
testicular pain
tetanic convulsion
thick white exudate on tongue
throat muscle paralysis
throat pain
thrombocytopenia
thymus symptom
thyroid abscesses
thyroid symptom
tinnitus
tiredness
tonic seizure
tonic-clonic seizure
toothache
toxemia
tracheitis
tracheobronchitis
transient alteration of awareness
transient fever
transient paralysis of limb
underweight
unreactive mydriasis
urge incontinence
vasculitis
ventricular bradycardia
ventricular fibrillation
ventricular tachycardia
vertigo
very high fever
visceral pain
vision distortion
voice disturbance
weak cry
weariness
wheelbarrowing
wheezing
wobble
wound discharge
yellow dropping
yellow exudate from eyes
yellow exudate from nose
yellowish green diarrhea
fever
{cyclic|sudden onset of|transient|low-grade|prolonged|mild|high|very high|Pel-Epstein|continuous|remittent|relapsing} fever

35
data/units-of-time.mg Normal file
View file

@ -0,0 +1,35 @@
// description: A list of units of time ordered by magnitude, both formal and colloquial.
output
[formal_time_unit]
[informal_discrete_time_unit]
[informal_nondiscrete_time_unit]
formal_time_unit
nanosecond
microsecond
millisecond
second
minute
hour
day
week
month
year
decade
century
millenium
informal_discrete_time_unit
fortnight
blue moon
30 days
90 days
quarter
informal_nondiscrete_time_unit
moment
a while
a bit
later
soon

126
data/vegetables.mg Normal file
View file

@ -0,0 +1,126 @@
// description: Some vegetables.
output
[vegetable]
vegetable
acorn squash
alfalfa sprout
amaranth
anise
artichoke
arugula
asparagus
aubergine
azuki bean
banana squash
basil
bean sprout
beet
black bean
black-eyed pea
bok choy
borlotti bean
broad beans
broccoflower
broccoli
brussels sprout
butternut squash
cabbage
calabrese
caraway
carrot
cauliflower
cayenne pepper
celeriac
celery
chamomile
chard
chayote
chickpea
chives
cilantro
collard green
corn
corn salad
courgette
cucumber
daikon
delicata
dill
eggplant
endive
fennel
fiddlehead
frisee
garlic
gem squash
ginger
green bean
green pepper
habanero
herbs and spice
horseradish
hubbard squash
jalapeno
jerusalem artichoke
jicama
kale
kidney bean
kohlrabi
lavender
leek
legume
lemon grass
lentils
lettuce
lima bean
mamey
mangetout
marjoram
mung bean
mushroom
mustard green
navy bean
new zealand spinach
nopale
okra
onion
oregano
paprika
parsley
parsnip
patty pan
pea
pinto bean
potato
pumpkin
radicchio
radish
rhubarb
rosemary
runner bean
rutabaga
sage
scallion
shallot
skirret
snap pea
soy bean
spaghetti squash
spinach
squash
sweet potato
tabasco pepper
taro
tat soi
thyme
topinambur
tubers
turnip
wasabi
water chestnut
watercress
white radish
yam
zucchini

639
data/verb.mg Normal file
View file

@ -0,0 +1,639 @@
// description: A list of English verbs.
output
[verb]
verb
accept
add
admire
admit
advise
afford
agree
alert
allow
amuse
analyse
announce
annoy
answer
apologise
appear
applaud
appreciate
approve
argue
arrange
arrest
arrive
ask
attach
attack
attempt
attend
attract
avoid
back
bake
balance
ban
bang
bare
bat
bathe
battle
beam
beg
behave
belong
bleach
bless
blind
blink
blot
blush
boast
boil
bolt
bomb
book
bore
borrow
bounce
bow
box
brake
branch
breathe
bruise
brush
bubble
bump
burn
bury
buzz
calculate
call
camp
care
carry
carve
cause
challenge
change
charge
chase
cheat
check
cheer
chew
choke
chop
claim
clap
clean
clear
clip
close
coach
coil
collect
colour
comb
command
communicate
compare
compete
complain
complete
concentrate
concern
confess
confuse
connect
consider
consist
contain
continue
copy
correct
cough
count
cover
crack
crash
crawl
cross
crush
cry
cure
curl
curve
cycle
dam
damage
dance
dare
decay
deceive
decide
decorate
delay
delight
deliver
depend
describe
desert
deserve
destroy
detect
develop
disagree
disappear
disapprove
disarm
discover
dislike
divide
double
doubt
drag
drain
dream
dress
drip
drop
drown
drum
dry
dust
earn
educate
embarrass
employ
empty
encourage
end
enjoy
enter
entertain
escape
examine
excite
excuse
exercise
exist
expand
expect
explain
explode
extend
face
fade
fail
fancy
fasten
fax
fear
fence
fetch
file
fill
film
fire
fit
fix
flap
flash
float
flood
flow
flower
fold
follow
fool
force
form
found
frame
frighten
fry
gather
gaze
glow
glue
grab
grate
grease
greet
grin
grip
groan
guarantee
guard
guess
guide
hammer
hand
handle
hang
happen
harass
harm
hate
haunt
head
heal
heap
heat
help
hook
hop
hope
hover
hug
hum
hunt
hurry
identify
ignore
imagine
impress
improve
include
increase
influence
inform
inject
injure
instruct
intend
interest
interfere
interrupt
introduce
invent
invite
irritate
itch
jail
jam
jog
join
joke
judge
juggle
jump
kick
kill
kiss
kneel
knit
knock
knot
label
land
last
laugh
launch
learn
level
license
lick
lie
lighten
like
list
listen
live
load
lock
long
look
love
man
manage
march
mark
marry
match
mate
matter
measure
meddle
melt
memorise
mend
mess up
milk
mine
miss
mix
moan
moor
mourn
move
muddle
mug
multiply
murder
nail
name
need
nest
nod
note
notice
number
obey
object
observe
obtain
occur
offend
offer
open
order
overflow
owe
own
pack
paddle
paint
park
part
pass
paste
pat
pause
peck
pedal
peel
peep
perform
permit
phone
pick
pinch
pine
place
plan
plant
play
please
plug
point
poke
polish
pop
possess
post
pour
practise
pray
preach
precede
prefer
prepare
present
preserve
press
pretend
prevent
prick
print
produce
program
promise
protect
provide
pull
pump
punch
puncture
punish
push
question
queue
race
radiate
rain
raise
reach
realise
receive
recognise
record
reduce
reflect
refuse
regret
reign
reject
rejoice
relax
release
rely
remain
remember
remind
remove
repair
repeat
replace
reply
report
reproduce
request
rescue
retire
return
rhyme
rinse
risk
rob
rock
roll
rot
rub
ruin
rule
rush
sack
sail
satisfy
save
saw
scare
scatter
scold
scorch
scrape
scratch
scream
screw
scribble
scrub
seal
search
separate
serve
settle
shade
share
shave
shelter
shiver
shock
shop
shrug
sigh
sign
signal
sin
sip
ski
skip
slap
slip
slow
smash
smell
smile
smoke
snatch
sneeze
sniff
snore
snow
soak
soothe
sound
spare
spark
sparkle
spell
spill
spoil
spot
spray
sprout
squash
squeak
squeal
squeeze
stain
stamp
stare
start
stay
steer
step
stir
stitch
stop
store
strap
strengthen
stretch
strip
stroke
stuff
subtract
succeed
suck
suffer
suggest
suit
supply
support
suppose
surprise
surround
suspect
suspend
switch
talk
tame
tap
taste
tease
telephone
tempt
terrify
test
thank
thaw
tick
tickle
tie
time
tip
tire
touch
tour
tow
trace
trade
train
transport
trap
travel
treat
tremble
trick
trip
trot
trouble
trust
try
tug
tumble
turn
twist
type
undress
unfasten
unite
unlock
unpack
untidy
use
vanish
visit
wail
wait
walk
wander
want
warm
warn
wash
waste
watch
water
wave
weigh
welcome
whine
whip
whirl
whisper
whistle
wink
wipe
wish
wobble
wonder
work
worry
wrap
wreck
wrestle
wriggle
x-ray
yawn
yell
zip
zoom

271
data/weather.mg Normal file
View file

@ -0,0 +1,271 @@
// description: A list of phrases describing weather conditions. This list includes all possible phrases that may be provided by the US National Weather Service's feeds of current weather conditions.
// source: http://w1.weather.gov/xml/current_obs/weather.php
output
[weather]
weather
Mostly Cloudy
Mostly Cloudy with Haze
Mostly Cloudy and Breezy
Fair
Clear
Fair with Haze
Clear with Haze
Fair and Breezy
Clear and Breezy
A Few Clouds
A Few Clouds with Haze
A Few Clouds and Breezy
Partly Cloudy
Partly Cloudy with Haze
Partly Cloudy and Breezy
Overcast
Overcast with Haze
Overcast and Breezy
Fog/Mist
Fog
Freezing Fog
Shallow Fog
Partial Fog
Patches of Fog
Fog in Vicinity
Freezing Fog in Vicinity
Shallow Fog in Vicinity
Partial Fog in Vicinity
Patches of Fog in Vicinity
Light Freezing Fog
Heavy Freezing Fog
Smoke
Freezing Rain
Freezing Drizzle
Light Freezing Rain
Light Freezing Drizzle
Heavy Freezing Rain
Heavy Freezing Drizzle
Freezing Rain in Vicinity
Freezing Drizzle in Vicinity
Ice Pellets
Light Ice Pellets
Heavy Ice Pellets
Ice Pellets in Vicinity
Showers Ice Pellets
Thunderstorm Ice Pellets
Ice Crystals
Hail
Small Hail/Snow Pellets
Light Small Hail/Snow Pellets
Heavy small Hail/Snow Pellets
Showers Hail
Hail Showers
Freezing Rain Snow
Light Freezing Rain Snow
Heavy Freezing Rain Snow
Freezing Drizzle Snow
Light Freezing Drizzle Snow
Heavy Freezing Drizzle Snow
Snow Freezing Rain
Light Snow Freezing Rain
Heavy Snow Freezing Rain
Snow Freezing Drizzle
Light Snow Freezing Drizzle
Heavy Snow Freezing Drizzle
Rain Ice Pellets
Light Rain Ice Pellets
Heavy Rain Ice Pellets
Drizzle Ice Pellets
Light Drizzle Ice Pellets
Heavy Drizzle Ice Pellets
Ice Pellets Rain
Light Ice Pellets Rain
Heavy Ice Pellets Rain
Ice Pellets Drizzle
Light Ice Pellets Drizzle
Heavy Ice Pellets Drizzle
Rain Snow
Light Rain Snow
Heavy Rain Snow
Snow Rain
Light Snow Rain
Heavy Snow Rain
Drizzle Snow
Light Drizzle Snow
Snow Drizzle
Light Snow Drizzle
Heavy Drizzle Snow
Rain Showers
Light Rain Showers
Light Rain and Breezy
Heavy Rain Showers
Rain Showers in Vicinity
Light Showers Rain
Heavy Showers Rain
Showers Rain
Showers Rain in Vicinity
Rain Showers Fog/Mist
Light Rain Showers Fog/Mist
Heavy Rain Showers Fog/Mist
Rain Showers in Vicinity Fog/Mist
Light Showers Rain Fog/Mist
Heavy Showers Rain Fog/Mist
Showers Rain Fog/Mist
Showers Rain in Vicinity Fog/Mist
Thunderstorm
Thunderstorm Rain
Light Thunderstorm Rain
Heavy Thunderstorm Rain
Light Thunderstorm Rain Haze
Heavy Thunderstorm Rain Haze
Thunderstorm Fog
Light Thunderstorm Rain Fog
Heavy Thunderstorm Rain Fog
Thunderstorm Light Rain
Thunderstorm Heavy Rain
Thunderstorm Rain Fog/Mist
Thunderstorm Light Rain Fog/Mist
Thunderstorm Heavy Rain Fog/Mist
Thunderstorm in Vicinity Fog/Mist
Thunderstorm Showers in Vicinity
Thunderstorm in Vicinity Haze
Thunderstorm Haze in Vicinity
Thunderstorm Light Rain Haze
Thunderstorm Heavy Rain Haze
Thunderstorm Light Rain Fog
Thunderstorm Heavy Rain Fog
Thunderstorm Hail
Light Thunderstorm Rain Hail
Heavy Thunderstorm Rain Hail
Light Thunderstorm Rain Hail Fog/Mist
Heavy Thunderstorm Rain Hail Fog/Hail
Thunderstorm Showers in Vicinity Hail
Light Thunderstorm Rain Hail Haze
Heavy Thunderstorm Rain Hail Haze
Thunderstorm Hail Fog
Light Thunderstorm Rain Hail Fog
Heavy Thunderstorm Rain Hail Fog
Thunderstorm Light Rain Hail
Thunderstorm Heavy Rain Hail
Thunderstorm Rain Hail Fog/Mist
Thunderstorm Light Rain Hail Fog/Mist
Thunderstorm Heavy Rain Hail Fog/Mist
Thunderstorm in Vicinity Hail
Thunderstorm in Vicinity Hail Haze
Thunderstorm Haze in Vicinity Hail
Thunderstorm Light Rain Hail Haze
Thunderstorm Heavy Rain Hail Haze
Thunderstorm Light Rain Hail Fog
Thunderstorm Heavy Rain Hail Fog
Thunderstorm Small Hail/Snow Pellets
Thunderstorm Rain Small Hail/Snow Pellets
Light Thunderstorm Rain Small Hail/Snow Pellets
Heavy Thunderstorm Rain Small Hail/Snow Pellets
Snow
Light Snow
Heavy Snow
Snow Showers
Light Snow Showers
Heavy Snow Showers
Showers Snow
Light Showers Snow
Heavy Showers Snow
Snow Fog/Mist
Light Snow Fog/Mist
Heavy Snow Fog/Mist
Snow Showers Fog/Mist
Light Snow Showers Fog/Mist
Heavy Snow Showers Fog/Mist
Showers Snow Fog/Mist
Light Showers Snow Fog/Mist
Heavy Showers Snow Fog/Mist
Snow Fog
Light Snow Fog
Heavy Snow Fog
Snow Showers Fog
Light Snow Showers Fog
Heavy Snow Showers Fog
Showers Snow Fog
Light Showers Snow Fog
Heavy Showers Snow Fog
Showers in Vicinity Snow
Snow Showers in Vicinity
Snow Showers in Vicinity Fog/Mist
Snow Showers in Vicinity Fog
Low Drifting Snow
Blowing Snow
Snow Low Drifting Snow
Snow Blowing Snow
Light Snow Low Drifting Snow
Light Snow Blowing Snow
Light Snow Blowing Snow Fog/Mist
Heavy Snow Low Drifting Snow
Heavy Snow Blowing Snow
Thunderstorm Snow
Light Thunderstorm Snow
Heavy Thunderstorm Snow
Snow Grains
Light Snow Grains
Heavy Snow Grains
Heavy Blowing Snow
Blowing Snow in Vicinity
Windy
Breezy
Fair and Windy
A Few Clouds and Windy
Partly Cloudy and Windy
Mostly Cloudy and Windy
Overcast and Windy
Showers in Vicinity
Showers in Vicinity Fog/Mist
Showers in Vicinity Fog
Showers in Vicinity Haze
Freezing Rain Rain
Light Freezing Rain Rain
Heavy Freezing Rain Rain
Rain Freezing Rain
Light Rain Freezing Rain
Heavy Rain Freezing Rain
Freezing Drizzle Rain
Light Freezing Drizzle Rain
Heavy Freezing Drizzle Rain
Rain Freezing Drizzle
Light Rain Freezing Drizzle
Heavy Rain Freezing Drizzle
Thunderstorm in Vicinity
Thunderstorm in Vicinity Fog
Light Rain
Drizzle
Light Drizzle
Heavy Drizzle
Light Rain Fog/Mist
Drizzle Fog/Mist
Light Drizzle Fog/Mist
Heavy Drizzle Fog/Mist
Light Rain Fog
Drizzle Fog
Light Drizzle Fog
Heavy Drizzle Fog
Rain
Heavy Rain
Rain Fog/Mist
Heavy Rain Fog/Mist
Rain Fog
Heavy Rain Fog
Funnel Cloud
Funnel Cloud in Vicinity
Tornado/Water Spout
Dust
Low Drifting Dust
Blowing Dust
Sand
Blowing Sand
Low Drifting Sand
Dust/Sand Whirls
Dust/Sand Whirls in Vicinity
Dust Storm
Heavy Dust Storm
Dust Storm in Vicinity
Sand Storm
Heavy Sand Storm
Sand Storm in Vicinity
Haze

119
data/wind.mg Normal file
View file

@ -0,0 +1,119 @@
// description: A list of regional and local winds and weather phenomena.
// source: https://en.wikipedia.org/wiki/List_of_local_winds
// http://www.ggweather.com/windsoftheworld.htm
output
[wind]
wind
abrolhos
alisio
alizé
alizé maritime
amihan
autan
bad-i-sad-o-bist-roz
barber
barguzin
bayamo
berg
bise
blue norther
bora
brickfielder
brisote
buran
calima
carpinteiro
cape doctor
cers
chinook
cierzo
coho
cordonazo
coromuel
crivăț
descuernacabras
diablo
elephanta
etesian
euroclydon
foehn
föhn
fremantle doctor
furious fifties
garua
ghibli
gilavar
gregale
habagat
haizebeltza
halny
harmattan
helm
kali andhi
karaburan
karakaze
khamsin
khazri
kona
košava
laawan
leste
levanter
leveche
libeccio
llevantades
lodos
loo
maestro
marin
matacabras
meltem
meltemi
minuano
mistral
mono
monsoon
n'aschi
nigeq
norte
nor'easter
nor'wester
oroshi
ostro
pampero
papagayo
passat
piteraq
poniente
puelche
purga
roaring forties
santa ana
santa lucia
sarma
screaming sixties
shamal
sharav
sharqi
simoom
sirocco
solano
southerly buster
sou'wester
squamish
sudestada
suêtes
sukhovey
sundowner
tehuano
tehuantepecer
tramontane
vendavel
warm braw
washoe zephyr
wisper
witch of November
wreckhouse
zonda

18
data/your-pack.mg Normal file
View file

@ -0,0 +1,18 @@
output
Your [pack] contains [item], [item] and [item].
item
a few coins
an old {silver|bronze} ring
a handkerchief
a shard of bone
some lint
a tin of tea leaves
pack
purse
backpack
bag
pack
knapsack
rucksack

12
info.rkt Normal file
View file

@ -0,0 +1,12 @@
#lang info
(define collection "moonrat")
(define deps '("base" "parsack" "english"))
(define build-deps '("scribble-lib" "racket-doc" "rackunit-lib"))
(define scribblings '(("scribblings/moonrat.scrbl" ())))
(define pkg-desc "Moon Rat Gardener for creating random text generators.")
(define raco-commands '(("moonrat" moonrat/src/moonrat "random text generator" #f)
("cp2mg" moonrat/src/cp2mg "convert 'corpora' files" #f)))
(define version "0.1")
(define pkg-authors '("nik gaffney"))
(define license '(GPL-3.0-or-later))
;; docs and data licensed with either '(CC0-1.0 OR CC-BY-SA-4.0)

12
main.rkt Normal file
View file

@ -0,0 +1,12 @@
#lang racket/base
(require "src/parser.rkt"
"src/generator.rkt"
"src/verbose.rkt")
(provide verbose
verbose?
generate
parse-result
load-generator-file
(all-defined-out))

142
scribblings/moonrat.scrbl Normal file
View file

@ -0,0 +1,142 @@
#lang scribble/manual
@require[@for-label[moonrat
racket/base]]
@title{Moon Rat Gardener}
@author[(author+email "nik gaffney" "nik at fo.am")]
@defmodule[moonrat]
@section[#:tag "sec0"]{Moon Rat Gardening}
A simple template based text generator. aka. Moon Rat Gardener
MRG is a template based text generator closely following the @hyperlink["https://perchance.org"]{perchance} grammar and borrowing features (or non-features) from similar generators such as rant, tracery, lorem ipsum, dada engine etc. MRG aims to be simple to use and easy to read. Extensibility is possible but shouldnt be at the expense of readability or simplicity. Extraneous syntax is kept to a minimum.
Generators are usually built around list substitution (such as this example from the perchance documentation).
@verbatim{
output
Your [pack] contains [item], [item] and [item].
pack
purse
backpack
bag
pack
knapsack
rucksack
item
a few coins
an old {silver|bronze} ring
a handkerchief
a shard of bone
some lint
a tin of tea leaves
}
This template generates sentences like “Your purse contains some lint, a few coins and a handkerchief.” or “Your knapsack contains a few coins, a shard of bones and an old silver ring.”
@section[#:tag "sec1"]{Writing templates}
Templates are written in plain text with placeholders for text that can be replaced. They are usually based around lists of words or phrases. Special characters are limited to the square and curly brackets. i.e. “[ ]” and “{ }”. (Further examples can be found in the data folder).
The inclusion of a word in square brackets, like @tt{[word]}, will select an item from the list named @tt{word}. A list begins with a single word label and is followed by lines indented with 2 spaces.
Curly brackets can be used to indicate a choice, @tt{{this|that|the other}} or a range of numbers @tt{{1-101}} and can also be used to generate the correct article or plural for a word using @tt{{a}} or @tt{{s}} (e.g. @tt{fish{s}} generates “fishes” and @tt{ox{s}} generates “oxen”)
There are some modifier functions with the form @tt{[word.modifier]} that can be used to as filters (e.g. @tt{[mouse.plural]} give “mice” or @tt{[mouse.upcase]} gives “MOUSE”)
A template needs to include an @tt{output} label with at least one item. An element is chosen randomly from the @tt{output} list and used to generate a single output text.
@verbatim{
output
one word
}
The @tt{output} items can select from a list like so…
@verbatim{
output
[word]
word
lonely
}
@section[#:tag "sec3"]{Generate text}
@defform[(load-generator-file file-path)
#:contracts ((file-path string?))]{
Load an MRG template from a file.}
@defform[(load-generator-string template)
#:contracts ((template string?))]{
Load an MRG template from a string.}
@defform[(generate)]{
Generate some text from the currently active MRG template.}
@bold{Generate text from a racket programme}
Read a template from a file and generate text...
@codeblock{
#lang racket
(require moonrat)
(load-generator-file "music-genre.mg")
(generate)
}
@bold{Generate text from the command line}
Run @tt{moonrat} with a template file to generate text on the command line…
@verbatim{raco moonrat data/music-genre.mg}
further details…
@verbatim{raco moonrat -h}
@section[#:tag "sec4"]{Moon Grade Ranter}
@hyperlink["https://tinysubversions.com/"]{Darius Kazemi} has compiled a @hyperlink["https://github.com/dariusk/corpora"]{collection of copora} for “the creation of weird internet stuff” specifically for text generation. MRG includes a basic conversion utility to help use these lists with moonrat. The converted lists are not validated in any way and will almost certainly need some manual coercion to be useful.
copora can be converted from a given url
@verbatim{raco cp2mg -u https://raw.githubusercontent.com/dariusk/corpora/master/data/colors/fictional.json}
or file…
@verbatim{raco cp2mg -f data/corpora/interjections.json -o data/interjections.mg}
@section[#:tag "sec5"]{Weird Machinery}
The templates are almost certainly a weird machine capable of unexpected machinations using list substitution (well formed recursive lists) and choice (even without assignment). Implementation is left as an exercise for the reader (see also string rewriting and @hyperlink["https://esolangs.org/wiki/Antigram"]{antigram})
@section[#:tag "sec6"]{Syntax & grammar}
@itemlist[@item{output}
@item{a word}
@item{a [word]}
@item{{word|another word}}
@item{{a} thing}
@item{some thing{s}}
@item{a [word.plural]}
@item{[the four word title.title-case]}
@item{a [nested.list.word]}
@item{// comments are on a line by themselves (not yet inline)}]
(to be continued…)
@section[#:tag "sec7"]{links & further}
Included, precluded, transcluded and occluded…
@itemlist[@item{@hyperlink["https://perchance.org/useful-generators"]{useful perchance generators}}
@item{@hyperlink["https://perchance.org/generators"]{more perchance generators}}
@item{@hyperlink["https://github.com/rant-lang/rant"]{rant}}
@item{@hyperlink["https://dev.null.org/dadaengine/manual-1.0/dada_toc.html"]{the dada engine}}
@item{@hyperlink["https://github.com/dariusk/corpora"]{corpora}}
@item{@hyperlink["https://github.com/catseye/NaNoGenLab"]{NaNoGenLab}}]

175
src/cp2mg.rkt Executable file
View file

@ -0,0 +1,175 @@
#! /usr/bin/env racket
#lang racket
;; Conversion utility for corpora.json files to MRG templates
;;
;; Copyright (C) 2022 FoAM
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see http://www.gnu.org/licenses/
;; Authors
;; - nik gaffney <nik@fo.am>
;; Darius Kazemi has compiled a collection of copora for “the creation
;; of weird internet stuff” specifically for text generation.
;; This is a basic conversion utility to help use these lists with moonrat.
;; The converted lists are not validated in any way and will almost
;; certainly need some manual coercion to be useful.
;; https://github.com/dariusk/corpora/blob/master/data/animals/ant_anatomy.json
(require json
net/url)
;; echoing verbosity
(define-syntax verbose
(syntax-rules ()
((verbose str ...) (when (verbose?) (printf str ...)))))
;; remapping
(define (cp2mg path)
(let ((corpora (load-corpora-file path)))
(hash-map corpora
parse-element)))
(define (parse-element k v)
(verbose "parsing: ~s -> ~s~n" k v)
(cond
;; comments, source or description
((string-ci=? (stringify k) "comments")
(format "// ~a~n" (stringify v)))
((string-ci=? (stringify k) "description")
(format "// description: ~a~n" v))
((string-ci=? (stringify k) "source")
(format "// source: ~a~n" v))
;; nested list
((and (string? (stringify k)) (hash? v))
(verbose "~nparsing nested string & hash...~n")
(format "~a~n ~a~n" (stringify k) (hash-map v parse-element)))
;; list of options
((and (string? (stringify k)) (list? v))
(verbose "~nparsing string & list: ~s -> ~s~n" k v)
(format "~a~n ~a~n"
(stringify k)
(string-join (map stringify v) "\n ")))
;; list with single option
((and (string? (stringify k)) (string? (stringify v)))
(verbose "~nparsing string & string: ~s -> ~s~n" k v)
(format "~a~n ~a~n" (stringify k) (stringify v)))
;; something else
(else "wonk?")))
(define (description-prefix? s)
(when (not (null? s))
(string-prefix? s "// description")))
;; output
(define (print-element e)
(cond
((string? e) (printf e))
((symbol? e) (printf e))
((number? e) (printf e))
((list? e) (printf "~a" (string-join (flatten e))))
(else null)))
(define (format-element e)
(cond
((string? e) (format "~a" e))
((symbol? e) (format "~a" e))
((number? e) (format "~a" e))
((list? e) (format "~a" (string-join (flatten e))))
(else null)))
(define (print-corpora l)
(for-each
print-element
(cons
(car (filter description-prefix? l))
(filter (lambda (e) (not (description-prefix? e))) l))))
(define (format-corpora l)
(string-join
(map
format-element
(cons
(car (filter description-prefix? l))
(filter (lambda (e) (not (description-prefix? e))) l)))))
;; text [un]mangling
(define (stringify s)
(cond
((string? s) s)
((symbol? s) (symbol->string s))
((number? s) (number->string s))
((list? s) (string-join (flatten s)))
(else "")))
;; load a corpora from a string or file
(define (load-corpora-string str)
(read-json str))
(define (load-corpora-file path)
(call-with-input-file* path
(lambda (string)
(load-corpora-string string))))
;; or a url
(define (load-corpora-url url)
(let ((corpora (call/input-url
(string->url url)
get-pure-port
load-corpora-string)))
(hash-map corpora
parse-element)))
;; cli options
(define verbose? (make-parameter #f))
(define filename (make-parameter ""))
(define out (make-parameter ""))
(define url (make-parameter ""))
(define getopt
(when (not (vector-empty?
(current-command-line-arguments))) ;; i.e. cli or not?
(command-line
#:program "cp2mg"
#:once-each
(("-v" "--verbose") "various verbose messages" (verbose? #t))
(("-f" "--from-file") path "convert from file" (filename path))
(("-o" "--output-file") path "write output to file" (out path))
(("-u" "--url") uri "convert from url" (url uri))
)))
(define (process-cli)
(when (non-empty-string? (url))
(let ((output (load-corpora-url (url))))
(verbose "Converting corpora from url: ~a\n" (url))
(if (non-empty-string? (out))
(display-to-file (format-corpora output)
(out) #:exists 'replace)
(print-corpora output))))
(when (non-empty-string? (filename))
(if (file-exists? (filename))
(let* ((path (filename))
(output (cp2mg path)))
(verbose "Converting corpora from file: ~a\n" path)
(if (non-empty-string? (out))
(display-to-file (format-corpora output)
(out) #:exists 'replace)
(print-corpora output)))
(raise-user-error 'cp2mg "File '~a' does not exist." (filename)))))
(process-cli)

189
src/generator.rkt Executable file
View file

@ -0,0 +1,189 @@
#! /usr/bin/env racket
#lang racket
;; Simple generator for MRG text generators.
;;
;; Copyright (C) 2022 FoAM
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see http://www.gnu.org/licenses/
;; Authors
;; - nik gaffney <nik@fo.am>
;; Requirements
;; - parsack, english & mzlib/string for retro compatibility
;; Commentary
;; see https://github.com/zzkt/moonrat
;;
;; current coverage
;; - lists & substitutions
;; - choice
;; - comments are (mostly) ignored
;; - a/an articles with {a}
;; - plural using an {s} suffix
;; - [animal.pluralForm] -> [animal]{s}
;; - numeric ranges (e.g. {1-33})
;; - (some) capitalisation
;;
;; not yet
;; - probability modifiers (e.g. worm^2)
;; - import (e.g. {import:noun}
;; - general inline processing (e.g. [animal.pluralForm] or [name.titleCase])
;; - nested lists (e.g. [descriptor.lifeforms.consumableList] )
;; - assignment and/or storing selections (e.g. [w = word.selectOne] )
;;
;; issues
;; - semi-semantic whitespace (trim and/or remove)
;; - $choice at beginning of line?
;; - not very useful parse errors -> guides
;; - shared/overwritten generator hash -> one per output?
;; - unreliable comment detection
(provide (all-defined-out))
(require english ;; articles & plurals
"parser.rkt"
"verbose.rkt"
"reader.rkt") ;; read-from-string-all
(define-namespace-anchor an0)
(define ns0 (namespace-anchor->namespace an0))
;;;;;; ;; ;
;;
;; construction & alleviation
;;
;; main generator -> (generate)
(define (output x)
(verbose "output: ~a~n" x))
;; text
(define (text x)
(verbose "text: ~s~n" x)
x)
;; choices
(define (choose x)
(verbose "choose -> ~a~n" x)
(let ((choice (car (shuffle x))))
(verbose "choice: ~a~n" choice)
choice))
;; import and substitute from list
(define (import-list x)
(verbose "import: ~a~n" x)
" ")
;; a number (int) within the given range
(define (random-integer x y)
(verbose "range: ~s-~s~n" x y)
(number->string (random x y)))
;; modifier - articles
(define (mod-article x)
(verbose "article: ~s~n" x)
(cond ((non-empty-string? x) (a/an x))
((list? x) (a/an (string-join (flatten x) "")))
(else "")))
;; modifier - plural
(define (mod-plural x)
(verbose "plural: ~s~n" x)
(cond ((non-empty-string? x) (plural x))
((list? x) (apply plural x))
(else "")))
(define (comment x)
(verbose "comment: ~a~n" x))
;; probably per generator rather than shared...
(define substitution-lists (make-hash))
(define (add-list l)
(hash-set! substitution-lists (car l) (rest l)))
(define (reset-generator)
(hash-clear! substitution-lists))
(define (select-from-list name)
(verbose "select from list '~a': ~s~n" name (hash-ref substitution-lists name))
(let ((es
(read-from-string-all
(car (shuffle (hash-ref substitution-lists name))))))
(verbose "substitute -> ~a~nwith -> ~s~n" name es)
(szeval es)))
(define (format-result l)
(when (list? l)
(string-join (flatten l) "")))
(define (generate)
(verbose "generating...~n")
(format-result
(select-from-list "output")))
;; load a generator from a string or file
(define (load-generator-string str)
(for-each eval-form
(parse-result $generator str)))
(define (load-generator-file path)
(call-with-input-file* path
(lambda (string)
(load-generator-string string))))
;; optional extras to convert
(define (title-case s)
(verbose ".titleCase: ~s~n" s)
(string-titlecase
(string-join (flatten (list s)) "")))
(define (upper-case s)
(verbose ".upperCase: ~s~n" s)
(string-upcase
(string-join (flatten (list s)) "")))
;; use 'plural' etc. from 'english'
;;;;;; ;; ;
;;
;; apply/eval loops
;;
;; eval forms of shape '(name (str ...))
;; e.g. '(choose ("this" "that" "the other"))
(define (szeval f)
(verbose "szeval: ~s ~n" f)
(cond
((symbol? f)
(eval f ns0))
((list? f)
(map (lambda (e) (eval e ns0)) f))
(else null)))
(define (szpply f a)
(verbose "szpply: ~s -> ~s ~n" f a)
(apply f a))
(define (eval-form f)
(verbose "eval-form: ~s~n" f)
(when (not (null? f))
(szpply (szeval (car f)) (cdr f))))

92
src/moonrat.el Normal file
View file

@ -0,0 +1,92 @@
;;; moonrat.el --- Mode for moon rat gardening -*- coding: utf-8; lexical-binding: t -*-
;; Copyright 2022 FoAM oü
;;
;; Author: nik gaffney <nik@fo.am>
;; Created: 2022-09-17
;; Version: 0.1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: text generation, generative, languages, tools
;; URL: https://github.com/zzkt/moonrat
;; This file is not part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; a mode for moon rat gardening with text templates.
;; see https://github.com/zzkt/moonrat
;;; Code:
(defun moonrat-generate ()
"Generate something."
(message "not yet..."))
(defvar moonrat-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "C-x g" #'moonrat-generate)
map))
(defconst moonrat-keywords
'(("output" . 'font-lock-function-name-face)))
;; (defconst moonrat-syntax-table
;; (let ((table (make-syntax-table)))
;; ;; brackets
;; (modify-syntax-entry ?\{ "(}" table)
;; (modify-syntax-entry ?\} "){" table)
;; (modify-syntax-entry ?\[ "(]" table)
;; (modify-syntax-entry ?\] ")[" table)
;; ;; / is punctuation, but // is a comment starter
;; (modify-syntax-entry ?/ ". 12" table)
;; ;; \n ends a comment
;; (modify-syntax-entry ?\n ">" table)
;; table))
;;;###autoload
(define-derived-mode moonrat-mode prog-mode "🌝"
"Major mode for a moon rat gardener."
;; :syntax-table moonrat-syntax-table
;; square brackets
(font-lock-add-keywords 'moonrat-mode '(("\\(\\[.*?]\\)"
1 font-lock-variable-name-face prepend)))
;; curly brackets
(font-lock-add-keywords 'moonrat-mode '(("\\({.*?\}\\)"
1 font-lock-constant-face prepend)))
;; list name
(font-lock-add-keywords nil '(("\\(^[^ ].*?$\\)"
1 font-lock-variable-name-face)))
;; comments
(font-lock-add-keywords 'moonrat-mode '(("\\(//.*?$\\)"
1 font-lock-comment-face)))
;; output block
(font-lock-add-keywords 'moonrat-mode '(("\\(^output\\)"
1 font-lock-function-name-face)))
;; other keywords?
(setq font-lock-defaults '(moonrat-keywords))
(setq-local comment-start "//")
(setq-local indent-tabs-mode t)
(font-lock-ensure))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.mg\\'" . moonrat-mode))
(provide 'moonrat)
;;; moonrat.el ends here

BIN
src/moonrat.elc Normal file

Binary file not shown.

47
src/moonrat.rkt Executable file
View file

@ -0,0 +1,47 @@
#! /usr/bin/env racket
#lang racket
;; Random text generator using MRG templates.
;;
;; Copyright (C) 2022 FoAM
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see http://www.gnu.org/licenses/
;; Authors
;; - nik gaffney <nik@fo.am>
;; Commentary
;; command line interface to MRG
(require moonrat)
(define filename (make-parameter ""))
(define getopt
(when (not (vector-empty?
(current-command-line-arguments))) ;; i.e. cli or not?
(command-line
#:program "moonrat"
#:once-each
(("-v" "--verbose") "various verbose messages" (verbose? #t))
#:args (input-file)
(filename input-file)
(parameterize ((verbose? (verbose?)))
(if (file-exists? (filename))
(let ((path (filename)))
(verbose "Using generator from ~a\n" path)
(load-generator-file path)
(printf "~a~n" (generate)))
(raise-user-error 'moonrat "File '~a' does not exist." (filename)))))))

316
src/parser.rkt Executable file
View file

@ -0,0 +1,316 @@
#! /usr/bin/env racket
#lang racket
;; Simple parser for MRG text generators.
;;
;; Copyright (C) 2022 FoAM
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see http://www.gnu.org/licenses/
;; Authors
;; - nik gaffney <nik@fo.am>
;; Requirements
;; - parsack, english & mzlib/string for retro compatibility
;; Commentary
;; see https://github.com/zzkt/moonrat
;;
;; current coverage
;; - lists & substitutions
;; - choice
;; - comments are (mostly) ignored
;; - a/an articles with {a}
;; - plural using an {s} suffix
;; - [animal.pluralForm] -> [animal]{s}
;; - numeric ranges (e.g. {1-33})
;; - (some) capitalisation
;;
;; not yet
;; - probability modifiers (e.g. worm^2)
;; - import (e.g. {import:noun}
;; - general inline processing (e.g. [animal.pluralForm] or [name.titleCase])
;; - nested lists (e.g. [descriptor.lifeforms.consumableList] )
;; - assignment and/or storing selections (e.g. [w = word.selectOne] )
;;
;; issues
;; - semi-semantic whitespace (trim and/or remove)
;; - $choice at beginning of line?
;; - not very useful parse errors -> guides
;; - shared/overwritten generator hash -> one per output?
;; - unreliable comment detection
(provide (all-defined-out)
(all-from-out parsack))
(require parsack)
;;;;;; ; ; ;;
;;
;; parsing & combinations
;;
;; string escape/quoting
(define (qstring s)
(cond
((string? s) (string-append "\"" s "\""))
((char? s) (string-append "\"" (make-string 1 s) "\""))
((list? s)
(cond ((eq? (length s) 1)
(qstring (car s)))
(else (map qstring s))))
(else "")))
;; numerics
(define $integer
(<?> (parser-compose
(x <- (many $digit))
(return (list->string x)))
"integer"))
(define $decimal
(<?> (parser-compose
(x <- (many1 $digit))
(char #\.)
(y <- (many $digit))
(return
(string-join (map list->string (list x y)) ".")))
"decimal"))
(define $number (<or> $integer $decimal))
;; basic punctuation (and/or unicode/emojis?)
(define $punctuation
(<?> (oneOf ",.:;/!?$&=><'\\\"()") "punctuation"))
;; characters used for operators
(define $operator
(<?> (oneOf "[]{}") "operator character"))
;; a word is a string of 1 or more alphanumeric characters (with some modifiers)
(define $basic-word
(<?> (parser-compose
(x <- (many1 (<any> $alphaNum (oneOf "_-&"))))
(return (list->string x)))
"basic word"))
;; only one sort of word (for now)
(define $word
(<?> $basic-word
"word"))
;; text is just words with semantics
(define $text
(<?> (parser-compose
(x <- (<any> $word $punctuation
(and $anyChar (<!> $operator)))) ;; unicode?
(return (list 'text (qstring x))))
"text"))
;; significant whitespace
(define $spc
(<?> (parser-compose
$space
(return (list 'text (qstring #\space))))
"printable space"))
;; blank line
(define $blank
(<?> (parser-compose
(x <- (<any> $eol (parser-seq (skipMany $space) $eol)))
(return null))
"blank line"))
;; comments are strings beginning with "//" that are ignored
(define $comment
(<?> (parser-compose (string "//")
(x <- $line)
(return null))
;; (return (list 'comment (map qstring x))))
"comment"))
;; a [word] which subsitutes from a list
(define $select
(<?> (parser-compose (char #\[)
(x <- $word)
(char #\])
(return (list 'select-from-list
(qstring x))))
"select"))
;; selection with operator e.g. [word.capitalize]
(define $select-dot
(<?> (parser-compose (char #\[)
(x <- $word)
(char #\.)
(y <- $word)
(char #\])
(return (list (string->symbol y)
(list 'select-from-list
(qstring x)))))
"select.dot"))
;; curly operators
;; {a|b} -> $choice
;; {import: } ->
;; {n-m} -> range of numbers
;; {A} -> look ahead article e.g {a|an}
;; {s} -> pluralize
;; multiple choice
(define $choice
(<?> (parser-compose
(char #\{)
(x <- (many1 (<or> (try $probability-modifier)
$word $spc)))
(char #\|)
(y <- (sepBy1 (many1 (<or> (try $probability-modifier)
$word $spc))
(char #\|)))
(char #\})
(return (list 'choose
(list 'quote
(cons (qstring x)
(map qstring y))))))
"choice"))
;; a range of numbers
(define $range
(<?> (parser-compose (char #\{)
(x <- $number)
(char #\-)
(y <- $number)
(char #\})
(return (list 'random-integer x y)))
"range"))
;; import from a file
;; - {import:name} or {import.name.list}
;; - just 'name' uses a list from a file (list name is same as basename)
;; - name.list is a 'list' in file 'name'
;; - only {import:name} supported for now?
(define $import
(<?> (parser-compose (string "{import:")
(x <- $basic-word)
(char #\})
(return (list 'import-list (qstring x))))
"import"))
;; things that can have articles or plurals
;; - $word $select $select-dot $import $choice
;; the correct indefinte article via {a}
(define $article-modifier
(<?> (parser-compose
(oneOfStrings "{a} " "{A} ")
(x <- (many1 (<any> $word
$select
$select-dot
$import
$choice))) ;; token? order of precedence?
(return (cons 'mod-article x)))
"{a} modifier"))
;; potential plurals via {s} -> lookahead/rewind
(define $plural-modifier
(<?> (parser-compose
(x <- (many1 (<or> $word
(try $select)
(try $import)
(try $choice)))) ;; token? order of precedence?
(string "{s}")
(return (cons 'mod-plural x)))
"modifer{s}"))
;; probability modifier e.g. word^2 (unimplemented)
(define $probability-modifier
(<?> (parser-compose
(x <- $word) ;; token? order of precedence?
(char #\^)
$number
(return (list 'text (qstring x))))
"prob^n?"))
;; things like {this}
;; - choice
;; - article modifier
;; - plural modifier
;; - range
;; - import
(define $op-curl
(<?> (<or>
(try $choice)
(try $import)
(try $range))
"{operator}"))
(define $modifier
(<?> (<or>
(try $article-modifier)
(try $plural-modifier)
(try $probability-modifier))
"modifier"))
;; things like [this]
;; - substitution
;; - sub with dot operator
(define $op-square
(<?> (<or>
(try $select)
(try $select-dot))
"[operator]"))
;; types of wordlike things
(define $token
(<?> (<or> $text
$spc
$punctuation
$op-curl
$op-square
(try $comment))
"wordlike token"))
;; a line can be composed of wordlike tokens...
(define $line
(<?> (parser-compose
(x <- (manyTill (<or> $modifier $token)
(<or> $eol $eof)))
(return (apply ~a x)))
"line"))
;; an element is a space indented, non blank line
(define $element
(<?> (parser-compose (string " ")
(x <- $line)
(return x)) "element"))
;; a list is a single word name followed by indented lines
(define $list
(<?> (parser-compose (x <- $word) $eol
(y <- (many $element))
(return (list 'add-list
(cons x y)))) "list"))
;; generate and test
(define $generator
(parser-compose
(x <- (many (<or> $list
$blank
$comment)))
$eof
(return x)))

32
src/reader.rkt Normal file
View file

@ -0,0 +1,32 @@
#lang racket
;; string reader from mzlib/string -> 'read-from-string-all'
;; via https://github.com/racket/compatibility/blob/master/compatibility-lib/mzlib/string.rkt
(provide read-from-string-all)
(define-syntax wrap-errors
(syntax-rules ()
[(wrap-errors who error-handler body ...)
(if error-handler
(with-handlers
([void
(cond [(not (procedure? error-handler))
(error who "bad error handler: ~e" error-handler)]
[(procedure-arity-includes? error-handler 1)
error-handler]
[(procedure-arity-includes? error-handler 0)
(lambda (exn) (error-handler))]
[else (error who "bad error handler: ~e" error-handler)])])
body ...)
(begin body ...))]))
(define (open-input-bstring s)
(if (bytes? s) (open-input-bytes s) (open-input-string s)))
(define (read-from-string-all str [error-handler #f])
(let ([p (open-input-bstring str)])
(wrap-errors 'read-from-string-all error-handler
(let loop ([r '()])
(let ([v (read p)])
(if (eof-object? v) (reverse r) (loop (cons v r))))))))

295
src/tests.rkt Normal file
View file

@ -0,0 +1,295 @@
#lang racket
;; MRG parsing & generator tests
(module+ test
;; Any code in this `test` submodule runs when this file is run using DrRacket
;; or with `raco test`. The code here does not run when this file is
;; required by another module.
(require rackunit
"parser.rkt"
"reader.rkt"
"verbose.rkt"
"generator.rkt")
(define test0 "adjective
small
big
cute
sneaky
unusual
helpful
mean
")
(define test1 "
output
{This|That} [animal] is so [adjective]!
I wish I could [verb] that [animal].
Aren't [animal]{s} just so [adjective]?
There must be at least four [animal]{s} (or [animal]{s}) [location]!
THE [animal]! It's eating {a} [common-noun]!
{A} [animal] is a bit like {a} [common-noun].
animal
pig
mouse
chicken
zebra
fish
jellyfish
worm
armadillo
adjective
small
big
cute
sneaky
unusual
helpful
mean
verb
pat
befriend
help
location
on {the|this|that} island
in {the|this|that} valley
{around|in} here
over there
under {a} {thing|thingie}
common-noun
spoon
block
slab
archive
")
(define test2 "
output
{This|That} [animal] is so [adjective]!
I wish I could [verb] that [animal].
Aren't [animal]{s} just so [adjective]?
There must be at least {1-10} [animal]{s} [location]!
THE [animal.upper-case]! It's eating the {import:common-noun}!
{A} [animal] is a bit like {a} {import:common-noun}.
animal
pig
cow
chicken
zebra
crayfish
jellyfish^0.5
worm^2
adjective
small
big
cute
sneaky
unusual
helpful
mean
verb
pat
befriend
help
location
on {the|this|that} island
in {the|this|that} valley
{around|in} here
over there
under this {thing^2|thingie}
")
(define test3 "// description: Unexpected Guests
output
{A} [adjective] [character] [unexpectedly] with {a} [noun1] that [verbs-thing]
{A} [character] [wearing], appearing [mood] with {a} [accessory]
[honorific] [character] ({a} [occupation])
{A} [character] eating {a} [biological-diet] [fast-food]
character
mycologist
installation artist
DJ
pilgrim
brother-in-law
verb
agree
alert
allow
amuse
analyse
announce
annoy
answer
unexpectedly
becomes a clock tower
looms at the door
wearing
wearing [fabric]
wearing [clothing]
fabric
silk
rubber
impractical
clothing
a cap
a cardigan
a coat
a cravat
rubber boots
scuba diving gear
mood
baffled
bashful
benevolent
betrayed
bewildered
bitter
accessory
travelling trunk
untuned balalaika
soldering iron
mummified cat
stolen e-bike
box
adjective
shuffling
extremely thin
massive
dark
formless
still
noun1
beast
spider
insect
thing
bird
humanoid
noun2
long arms
alien tattoos
tumorous growths
countless limbs
eyes
a single unblinking eye
verbs-thing
eats dreams
brings gifts
turns into something else
causes chaos
reflects the moonlight
is an extension of a greater organism
biological-diet
apivorous
baccivorous
batrachivorous
carnivorous
cepivorous
limivorous
fast-food
burger
burger
burger
burger
burger
burger
honorific
Mr
Ms
Dr
Count
Sir
Lady
occupation
mycologist
artist
cook
dragon breeder
collector
human
")
;; basic tests
(check-equal?
"word" (parse-result $word "word"))
(check-equal?
'(mod-article "oblong") (parse-result $article-modifier "{a} oblong"))
(printf "choice: ~a~n" (parse-result $choice "{wonk|wonkier}"))
(printf "word: ~a~n" (parse-result $word "wonk"))
(printf "number: ~a~n" (parse-result $number "1"))
(printf "number: ~a~n" (parse-result $number "101"))
(printf "number: ~a~n" (parse-result $number "101.99"))
(printf "a word: ~a~n" (parse-result $article-modifier "{a} wonk"))
(printf "a word: ~a~n" (parse-result $article-modifier"{a} oblong"))
(printf "substitute: ~a~n" (parse-result $select "[oblong]"))
(printf "plural: ~a~n" (parse-result $plural-modifier "oblong{s}"))
(printf "plural: ~a~n" (parse-result $plural-modifier "tooth{s}"))
(printf "plural: ~a~n" (parse-result $plural-modifier "[oblong]{s}"))
(printf "plural: ~a~n" (parse-result $article-modifier "{a} [thing]"))
(printf "choice: ~a~n" (parse-result $choice "{wonk|wonkier}"))
(printf "range: ~a~n" (parse-result $range "{7-33}"))
(printf "line: ~a~n" (parse-result $line "a simple line"))
(printf "line: ~a~n" (parse-result $line "{A} ordinary line"))
;; implement prob?
(printf "prob?: ~s~n"(parse-result $probability-modifier "simple^2"))
(printf "prob?: ~s~n"(parse-result $probability-modifier "simple^0.75"))
;; (printf "line: ~s~n" (parse-result $line "a {simple^0.5|complex} line"))
(printf "list: ~a~n" (parse-result $list test0))
;; (define out1 (parse-result $generator test1))
;; (printf "out1: ~a~n" (length out1))
(verbose? #t)
(define out2 (parse-result $generator test2))
(printf "~neval...~n")
(for-each eval-form out2)
(printf "~ngenerate...~n")
(generate)
;;(printf "~nload from file...~n")
;;(load-generator-file "../data/adjective.mg")
;; (load-generator-file "../data/unexpected-guests.mg")
;;(printf "~ngenerate...~n")
;;(generate)
(printf "~ntested...~n")
) ;; end module

11
src/verbose.rkt Normal file
View file

@ -0,0 +1,11 @@
#lang racket/base
(provide verbose?
verbose)
;; echoing verbosity
(define verbose? (make-parameter #f))
(define-syntax verbose
(syntax-rules ()
((verbose str ...) (when (verbose?) (printf str ...)))))