Sentence template question

Hi! I’ve got a sentence template issue I can’t figure out.

I’ve created a custom fact for “event with honoree” with multiple possible roles. The sentence template I created almost works:

[person]< and [other honoree]> were honored< at a [Desc]>< [Date]>< [PlaceDetails]>< [Place]>.< [attendee] attended.>

My question is: how do I make it so that “were” becomes “was” if there’s no “other honoree”?

Thanks!

You’ll need to use Switches.

Here’s the help article on the Sentence template language. Read that over and, if it doesn’t help you solve your challenge, c’mon back :wink:

1 Like

In particular, look for “plural switches” in the documentation.

1 Like

Thanks! I did look at the switches, but I couldn’t figure out how to make it work with two different roles - it looked like all the examples were for a single role.

The plural switch is not designed for your exact situation. Rather, it’s designed to detect whether [other honeree] is plural or not. I suspect that is what you already discovered. The only solution I can think of right now is something like the following.

[person] was honored. [other honeree] was/were also honored.

Sorry, but I have not taken the time chase down the exact syntax of the plural switch. But what happens is that the [other honeree] can be assigned to more than one person. In that case, the [other honoree] variable expands to be all the [other honeree] people even though the [other honoree] variable only appears once. Then you can use the plural switch to pick between “was” and “were”. But again, that’s not your situation, and I can’t think of a very graceful solution for your exact sitution.

That’s helpful, thanks! I’ll rewrite the sentence to eliminate the issue. It won’t be quite as elegant, but at least it will be grammatically correct!

I’ve used nested switching before. But it requires some programmer-like thinking to get the logic down and the sentence code can look pretty hairy.

Would this not work?

[person] <?[other honoree]|and [other honoree] were|was> honored< at a [Desc]>< [Date]>< [PlaceDetails]>< [Place]>.< [attendee] attended.>
1 Like

It does look like it to me.

<?[other honoree]|<?[person]|[person] and [other honoree] were honored|[other honoree] was honored>|<?[person]| [person] was honored|No one was honored>> Try it with your data David blank lines lost - apologies