nicholasudell / controlstrings Goto Github PK
View Code? Open in Web Editor NEWTemplate-based text generation for procedural text adventures.
License: MIT License
Template-based text generation for procedural text adventures.
License: MIT License
Transformers are special objects that operate on the result of a control string. The most common use case I can see is for capitalization.
For example, {Person:Pronoun:Singular} bring{Person:Pronoun:VerbEnding} you a gift
results in:
he brings you a gift
she brings you a gift
they bring you a gift
Whereas, with the pronoun at the start of the sentence, it should be He/She/They
respectively.
Proposed syntax for an example CapitalFirst Transformer:
{Person:Pronoun:Singular|CapitalFirst} bring{Person:Pronoun:VerbEnding} you a gift
The vertical bar denotes that the result of the control string will be piped into the transformer.
Further considerations:
{Person:Pronoun:Singular|CapitalFirst|Reverse}
to make strings like eH
or ehS
or yehT
StringBuilders concatenate strings using fewer allocations and are generally faster. Since building these strings could theoretically result in a huge number of concatenations, StringBuilder is the way to go.
At the moment the only guidance on how to use this is the Example.cs file included in the source.
That's pretty unacceptable.
It would simplify syntax and reduce small class clutter if we could include a ternary syntax conditional Control String Matcher.
Such a string would perhaps take the format {context:name?valueIfTrue:valueIfFalse}
(from Example.cs)
{Person:Pronoun:Singular} bring{Person:Pronoun:IsAlwaysPlural?:s} you a gift
This would resolve to:
he brings you a gift
or
they bring you a gift
As long as the They
pronoun returned true for IsAlwaysPlural
This would be set up something like this (in class Pronoun
):
new ConditionalControlStringMatcher("IsAlwaysPlural", () => AlwaysPlural))
Some questions to consider:
{Person:MiddleName:Exists?MiddleName:}
which would only show a person's middle name if it existed.{Person:MiddleName:Exists?MiddleName:Initial:}
which would print the initial of the person's middle name if one exists, otherwise blank.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.