I keep running into this issue: I have some bit of scenery whose vocab matches on various words from its description or the room description; some of those words are singular and some are plural, and I need to format responses accordingly. For example, I have a room description which includes “Through the dark and fog, the dense brambles of coniferous forest are visible only as silhouettes.” Then within it, I have this object:
+ brambles: Thing 'forest; dense coniferous spruce of[prep]; tangle brambles silhouettes branches'
"You don't need to see it clearly to know what's there: a tangle of
face-scratching, clothing-snagging spruce branches that you'd have to push
aside in ten places before every step."
isDecoration = true
ambiguouslyPlural = true
notImportantMsg = "You'd sooner just leave that alone."
;
The message “You’d sooner just leave that alone” is ungrammatical if the player referred to it by one of its plural descriptors, such as “branches”, but likewise “You’d sooner just leave those alone” would be ungrammatical if the noun was “forest”. I suppose I could create two otherwise-identical decorations, one of which responds to singular nouns and one to plural, but not only would that be verbose but also a recipe for bugs, as it would be easy to let something like this slip through:
> x dense
Did you mean the dense branches or the dense forest?
It’s where CollectiveGroup can shine and abused a little… because the group can be of only one element ! so, you can put the plural in a CollectiveGroup and the singular in a collectiveGroups (be careful not only to the CamelCase, but also of the singular/plural in the Group(s) part !)
Also I have not one, but two set of three identical fixtures (but significantly different in the details…) and for them indeed I used a decoration, whose doubles as hint giver.
IMRHO, what is the criteria for determining what solution is the most appropriate hinges on the differences, not only of synonyms, but also of actual differences and role in the narration. In my case the plural object is applied for sets of basically not-so-identical object, their differences part of solving a puzzle; OTOH, the [Cc]ollective is used for literally diverse objects, each delivering a contribuition to the narrative (albeit a substantial one. (SPOILER for The Portrait: the girls in the painting)
Said that, I’m giving again another engineering kick in my hind quarter for reminding, time and again, that I must clear all these Isekai spoilers from the Portrait source and finally honour the OS release…
I’m not clear on what I’m achieving here by using a CollectiveGroup that I wouldn’t achieve by using two separate objects. How should I set collectiveActions if I use this approach for the example I gave above?
Yeah, my initial thought there is the same, just say "You’d sooner just leave the forest alone. ", where by specifying something in your sentence it doesn’t really matter what vocab they used…
My first approach would definitely be to engineer the message to make it a non issue. In adv3, should that fall short, you could always finesse it with gAction.dobjMatch.getOrigText() and rexmatch that string to <<pluralMatch ? 'those' : 'that'>>. That is a lot of work though. Also not sure how to translate this to adv3lite.
If you want to see a more thorough example I could throw that together for you, but am branch predicting this looks unappetizing. And wrong library-ish.
I’m still dealing with the aftermath of christmas (three major eatings, christmas eve dinner, cristmas lunch and st.Stephen’s lunch, all multi-dishes… Italian dishes in size and taste… add to this an enlarged family around, and the picture should be clear, I’m off from coding, and the other major eating (new year’s eve dinner and new year’s lunch) looms… I’ll try to deliver a working example for the 29/30, but no promise until next year )
In this instance I could, but I’m trying to solve the general problem, especially since the whole reason I’m writing in TADS in the first place is as design research for Bedquilt. That means I’m both plundering adv3lite for good ideas and also trying to understand the precise contours of what it makes difficult so that Bedquilt can improve those things.
Unless I haven’t grasped the scope of your objective, what you’re trying to do seems to be pretty out of the mainstream and therefore doesn’t have library-dedicated handling.
As I’m sure you understand, a typical TADS game-world object is either marked isPlural or it isn’t. Of course, you’ve got situations where the object “forest”, not plural, includes vocab like “trees”, but usually you’re better off addressing all messages regarding that object with the plurality given to its object name, because as a gamemaker you’re crafting your responses for a “forest” specifically, and if there were nuances that would prompt different messages if they talked about “trees”, you’re better off separating the two objects. Now, you may have a perfectly valid scenario in your mind of something that could be referred to as singular or plural and you see a need for acknowledging the differences of grammatical number in your responses.
I just doubt whether that should be considered a “general problem” that an average library should be supposed to solve. It sounds to me like you’ve got to implement some extra mechanics during vocab preinit to tag tokens whose plurality is opposite of the object’s isPlural value. The parser would have to check whether one of those tokens was used, set a flag or be otherwise queriable (or temporarily reset the isPlural of the object in question), and then every response you write would either need an embedded expression or message param for terms (e.g. that/those, *s endings) that depend on pluraity.
I think this sentence reverses cause and effect: it’s out of the mainstream because it doesn’t have library-dedicated handling. Situations in which semantically-equivalent noun phrases can differ in grammatical number are pretty commonplace in everyday English (those people; that crowd). If we had tools that made such cases easy to handle, then we’d take advantage of them regularly. If such tools don’t exist or are too difficult to use, then we’ll just avoid the situation by writing mildly stilted prose. I strongly believe that there’s something akin to a Sapir-Whorf effect for programming languages: once we get too familiar with the limitations of our tools, they become limitations of our mind and we stop imagining that we’d ever want to do the unduly-difficult things in the first place.
In this case, what I have in mind for Bedquilt is that the tagging of tokens should be mostly automatic. Let a lemmatization tool scan your story file at compile time and automatically tag part of speech, number, proper vs. common nouns, etc. Story authors should only have to fill in this information manually if the tool misclassifies something.
I know this is definitely off topic, but I’m just curious. piergiorgio, did I read correctly that you celebrated St. Steven’s day last week? Are you (A) Christian of some sort, (B) from Catalonia, or (C) both? Just generally curious about Italian culture as I’m beginning to learn the language so I can keep up with the news coming out of Vatican City, as I’m Catholic and would rather read the materials in their native tongue.
Now back onto the topic at hand, a message parameter should do the trick, if memory serves, although depending on what you’re doing, it could require something more complex.
I won’t argue that, and I didn’t mean to come across as downplaying your idea. Also lemmatization tools weren’t even on my radar. Personally I wouldn’t be looking for ways to increase the amount or complexity of response messages that I have to write unless the object were really special
As I think about it you could probably accomplish the effect with relatively little effort in TADS:
//mix-in class
class SingAndPlural : object
isPlural = usedPluralToken
pluralTokens = []
usedPluralToken {
foreach (local tok in pluralTokens) {
if (gAction && gAction.getOrigText.find(tok))
return true;
}
return nil;
}
;
forest : SingAndPlural, Thing 'forest' 'forest/wood/trees/bushes'
pluralTokens = ['trees', 'bushes']
;
but of course you’d still have to write all of your messages in param or embedded expression form to reflect the plural changes.
The code for this would be a bit different in adv3Lite (I think one would need to look at gCommand.valToList(verbProd.tokenList).mapAll({x: getTokVal(x)}) to get at the tokens entered by the player), but the principle would be essentially the same. I may take a look at adding something like this to the next adv3Lite release.
EDIT: Actually, it would need to be something more like:
One could take it a stage further by introducing a new [pn] (plural noun) token in the vocab property to populate the pluralTokens list automaticically, along the lines of:
+ Decoration 'foliage;;leaves{pn];it them'
...
;
But unless there’s quite a bit of demand for such a feature it might be overkill.
Ooh, I really like this approach. I think you could even do that as a mod to the base Thing class, no? With a default empty list, it would basically degrade to default behavior.