Giter VIP home page Giter VIP logo

syllabore's Introduction

Nuget

What is this?

  • Syllabore is a procedural name generator that does not use pre-made lists of names
  • It can be embedded into a .NET program and used 100% offline

How are names generated?

  • Syllabore first constructs syllables out of characters (graphemes)
  • Then it sequences syllables into names

Table of Contents

  1. Quick Start
  2. Tailoring Characters
  3. Transformations
  4. Filtering
  5. Installation
  6. Compatibility
  7. License

Quick Start

Use the NameGenerator class to generate names. Call Next() to get a new name. By default, a subset of consonants and vowels from the English language will be used.

var g = new NameGenerator();
Console.WriteLine(g.Next());

This will return names like:

Pheras
Domar
Teso

Tailoring Characters

For simple generators, you can supply the vowels and consonants to use through the constructor:

var g = new NameGenerator("ae", "srnl");   

Names from this generator will only ever have the characters a and e for vowels, and the characters s r n and l for consonants. Calls to Next() will produce names like:

Lena
Salna
Rasse

See the wiki for more examples on how to control things like vowel sequences, consonant positioning, and more!

Transformations

A Transform is a mechanism for changing a source name into a new, modified name. Call UsingTransform() on a NameGenerator to specify one or more transformations:

var g = new NameGenerator()
        .UsingTransform(x => x
            .ReplaceSyllable(0, "zo") // Replace the first syllable with string "zo"
            .AppendSyllable("ri"));   // Adds a new syllable to end of name

Calling Next() produces names like:

Zocari
Zoshari
Zojiri

See the wiki for additional examples.

Filtering Output

Each NameGenerator can be configured to prevent specific substrings or patterns from showing up in names. Filtering is completely optional, but is useful in avoiding awkward sounding combinations of characters.

Here is a basic example of preventing substrings from appearing:

var g = new NameGenerator()
        .DoNotAllow("ist") // Will prevent names like "Misty"
        .DoNotAllow("ck"); // Will prevent names like "Brock"

See the wiki for additional examples.

Installation

Syllabore is available as a NuGet package. You can install it from your NuGet package manager in Visual Studio (search for "Syllabore") or by running the following command in your NuGet package manager console:

Install-Package Syllabore

There are a couple ways to do this in Godot:

  • Open your Godot project in Visual Studio and add the Syllabore NuGet package through the package manager
  • Or open a command line, cd into your Godot project directory, and use the following command:
dotnet add package Syllabore

Compatibility

By design, Syllabore is a .NET Standard 2.0 class library. This means it will be compatible with applications using:

  • .NET or .NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0
  • .NET Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
  • Mono 5.4, 6.4

Syllabore has been tested and known to work in the following game engines:

  • Godot 4 (Using the .NET edition of the engine)

Syllabore should also work in the following game engines, but I have not done adequate testing yet:

License

MIT License

Copyright (c) 2019-2024 Kevin Sacro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

syllabore's People

Contributors

kesac avatar monerofglory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

syllabore's Issues

Update to .NET 8

Though you have recently upgraded to .NET 7, .NET 8 has recently released and is the new "long term support" option from Microsoft. Given the last jump was .NET 5 -> .NET 7, it may be worthwhile to update to the latest, long-term support solution.

Documentation for .Invalidate

In the latest stable NuGet version 1.1.0, .Invalidate gives Compiler error: 'NameValidator' does not contain a definition for 'Invalidate' and no accessible extension method 'Invalidate' accepting a first argument of type 'NameValidator' could be found (are you missing a using directive or an assembly reference?)

I switched to .DoNotAllowPattern but wanted to note this for the documentation. Also thanks for Syllabore! It's extremely useful!

A replacement for OfTrailingConsonantIsSequence function

Cheers, just getting started with Syllabore but want to express my appreciation for the authors' work. So far this solution fits my needs the best of all I could find on Github.

This might be a mix of general questions and bug reports here, so I may split them into distinct issues.
I did read all the guides on the wiki. My version is 2.3.2.

  • So, in order to control last syllable's coda cluster I tried to set the probability for trailing consonants at 1 using the deprecated OfTrailingConsonantIsSequence function, since this is the only function I found which is able to configure that. Documentation suggests to use OfTrailingConsonants but then it appears to me I'm unable to assure the syllable does end with a coda cluster at all.

A side question there:

  • Should a SyllableGenerator with no vowel graphemes provided return an empty string? Also guide 1.1.2 mentions that onset and coda are optional, is that from a linguistic perspective or it is intended to be a constraint for SyllableGenerator?
    Are vowels intended to be mandatory to specify for SyllableGenerator to function?
    If I have no probabilities specified for SyllableGenerator making coda cluster to occur all the time, I get an exception due to an empty string generated as a result.

  • Also I noticed that when I try to override DefaultSyllableGenerator (and SyllableGenerator as well) trailing consonant cluster without specifying the probability, it never returns a syllable containing the coda cluster specified. (And in case of Syllable generator, an empty string is returned as mentioned above).

And tiny remarks for the guides:

  • 3.1 Section has a typo?
    Quote: "Names with three or more consonants in a row look are also difficult to read. Our NameFilter allows use to also identify patterns we want to avoid through regular expressions:"
  • At the end of the section a deprecated UsingProvider method is being used.

Thanks for your time!

Add Contribution Framework

I think this project would benefit with a way to get in touch to make contributions towards this public repository.

For example, I would like to contribute some Unit Test refactorings that I have made to the NameGeneratorTests.cs. How can we get in touch to request permission from you and permissions within GitHub to open a PR with changes for you to review.

Release version 2.4 on NuGet

Problem Space
I recently wanted to demonstrate a release version of Syllabore to a friend, but noticed that the latest version on NuGet was 2.3.1 released on October 11th 2023. There have since been many commits/features added!

What is your idea?
If you still wish to release your package via NuGet (the prerogative of the maintainer, of course), you should release a new version for use, especially with your new .NET 8 changes.

If you do not desire to maintain packages on NuGet, feel free to close this issue.

How will this benefit users of Syllabore?

  • It allows users to access up-to-date features and improvements.

Add a minimalistic visualizer

What is your idea?

  • Create a minimalistic visualizer for Syllabore
  • The visualizer should be a desktop app using Godot 4
  • The first version should:
    • Continuously generate names
    • Allow you to add or remove graphemes
    • Show the effect of changing graphemes on the output space
    • Allow you select a name and copy it to the clipboard
  • Transformers and Filters can be left for a future version

How will this benefit users of Syllabore?

  • It makes the library more appealing to use
  • The visualizer will serve as an example for integrating Syllabore in another program

[Feature Request] More Examples

Hey kesac,

Syllabore is a fantastic tool and works great, thanks a lot for creating it!

I'm having a hard time coming up with the right settings for specific requirements (lack of knowledge how language actually works) and was wondering if you (or someone else) is planning on adding more basic examples to help people getting a generator up and running? The examples that are already in the repo are great but a few more would be even better :)

Some ideas:

  • First name
  • Surname
  • Space ship name
  • Planet name
  • Animal name
  • Weapon name
  • ...

Inject random generator

I propose that all classes that use System.Random should provide a constructor overload that allows a Random instance to be injected by the caller.

This would allow the caller to create a random generator with a specific seed. This is helpful when creating test data that is always the same based on that seed. For example that would be the case, if one uses NUnit's random generator which is derived fromRandom and seeded individually for each test case.

Alternatively it could be injected as Func<int> or as an interface.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.