Spintax in Xojo

  1. 4 months ago

    I am totally new to Xojo, so I would appreciate whatever help anyone could give. I need a routine that will parse spintax text and produce the readable text from it. Does anyone know of something that will do this? Or has anyone else written something? I would be willing to pay for it.

  2. Bob K

    May 15 Pre-Release Testers, Xojo Pro Kansas City

    I think we'll need to know what spintax is first. Do you have a standards document, or at minimum, an example document?

  3. Dave S

    May 15 San Diego, California USA

    Seems there are not Spintax Standards.... I was curious so I looked it up.... everybody has implemented their own versions (kinda like Microsoft does)..... And wonders what the OP means by "readable text"... The Spintax data is clear text, and the whole idea is that a single line of code can produce X number of outputs.... hence the "Spin" part
    So how would you make a static output from a dynamic source

  4. Sorry...didn't think about people not knowing what "spintax" is. It is text written with separators that, when parsed, will select one item out of each group. See the following sentence as an example...

    {Writing|Creating} {articles|stories} is a {lot of fun|rewarding experience}.

    Between the {}, for any one iteration, one word/phrase would be chosen. This example only has two choice in each set of brackets, but there could be several. The above spintax could produce any of the follow sentences (and more)...

    Writing stories is a lot of fun.
    Creating articles is a rewarding experience.
    Creating stories is a rewarding experience.

  5. Here is another related question that someone asked about a year ago...

    https://forum.xojo.com/36949-php-class-to-xojo

  6. Dave S

    May 16 San Diego, California USA

    @DavidAshenfelder Between the {}, for any one iteration, one word/phrase would be chosen. This example only has two choice in each set of brackets, but there could be several. The above spintax could produce any of the follow sentences (and more)...

    From what little I have read , those examples are a very simplistic representation of the Spintax syntax... and there is no "standard"

  7. Eduardo G

    May 18 Pre-Release Testers Europe (Madrid, Spain)

    @Dave S From what little I have read , those examples are a very simplistic representation of the Spintax syntax... and there is no "standard"

    Agreed. If this was the whole extent of the "spintax syntax" it would be easy to parse.

    But from what I can see even this simple syntax gets more complex by allowing nesting.

    Nonetheless, the basic logic for parsing "spintax" (to produce the final texts) seems similar to a routine I wrote many years ago to parse outlines

    Essentially you can see a spintax text as a template where the variables also contain the possible values. If you don't need to add weighs so some "spinners" then you can map all possible paths and then pick randomly among them.

    I have a {car|bike} that I {|don't }like. And it's {very {big|small}|light {black|white}}.

    Becomes:

    I have a [1] that I [2] like. And it's [3].
    1: a:car, b:bike
    2: a:NULL, b:don't 
    3: a:very, b:light
    4: a:big, b:small
    5: a:black, b:white

    And literally spin all possible combinations of these:

    1.a, 2.a, 3.a, 4.a, 5.a
    1.a, 2.a, 3.a, 4,a 5.b
    1.a,2.a,3.a, 4.b, 5.a
    ...
    1.b,2.b,3.b.4.b,5.b

    With that just do a draft selecting at random until you run out of combinations or until you complete the number of versions you need.

or Sign Up to reply!