Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spintax function? #25

Open
cbmdfc opened this issue Jan 24, 2023 · 2 comments
Open

Spintax function? #25

cbmdfc opened this issue Jan 24, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@cbmdfc
Copy link

cbmdfc commented Jan 24, 2023

What did you do?

tried to use tgen to create free form texts but no support for something like spintax

What did you expect to see?

N/A

What did you see instead?

N/A

i would love if this tool would have a spintax capability like hello {world|Мир|mundo} but fitted for tgen

spasiba!

@patrickdappollonio patrickdappollonio self-assigned this Jan 25, 2023
@patrickdappollonio
Copy link
Owner

Hey @cbmdfc!

Thanks for opening this. I'm more than happy to add this feature, however, due to the nature of how Go templates work, the "format" to use it would be something like this, taking your own example:

hello {{ spintax "world" "Мир" "mundo" }}

Where it would choose one of the 3 provided words. It's quite more verbose, but I would love to know what you think. Another alternative that might be worth it would be something like:

hello {{ spintax "world|Мир|mundo" }}

The challenge, to me, is that the | symbol could be part of the text you're trying to spin, and as such, you would have to integrate something like spintaxCustomSplitting or similar:

hello {{ spintaxCustomSplitting "#" "world|Мир|mundo#John Doe"  }}

In the example above, # would be the custom one... I don't know you, but I don't really like the 2nd option and if I were to implement something like that here, it would be like the first example.

Also, some spintax tools have support for singular and plural handling and stuff like that. I will probably limit this feature just to spin across different strings, and not through a full spintax behaviour you can find elsewhere, mostly because you can work around these with the template engine as well.

Let me know what you think!

@patrickdappollonio patrickdappollonio added enhancement New feature or request good first issue Good for newcomers labels Jan 25, 2023
@cbmdfc
Copy link
Author

cbmdfc commented Sep 7, 2023

hello @patrickdappollonio apologies for late

spintax both with and wthout split looks good can you implement both if its not too much effort?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants