Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ebeshero
Copy link
Member

@ebeshero ebeshero commented Sep 2, 2025

@sydb @martindholmes @raffazizzi : This branch isn't passing tests yet, but I think we need a few more eyes on it to figure out how to fix it.
It's an attempt to solve #2758 on the way to (most likely) another patch release.

<alternate>
<alternate minOccurs="1" maxOccurs="unbounded">
<classRef key="model.global"/>
<elementRef key="speaker"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would allow any number of speaker elements at any position inside sp, wouldn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Carsten!

Copy link
Member Author

@ebeshero ebeshero Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this solution is overly permissive in that sense—particularly in allowing <speaker> anywhere. (Changing it to zero or one is probably not so big a problem to fix as limiting where it can occur.) We could add Schematron to constrain it further, and I figured it would hold if we can't find a better way quickly! (But I suspect we can.) I hope this is at least a starting point for a better solution.

…is not required and b) it is deterministic (aka non-ambiguous)
@sydb sydb removed their request for review September 2, 2025 22:49
@sydb
Copy link
Member

sydb commented Sep 2, 2025

@ebeshero opened this PR, and thus apparently cannot be a reviewer. Nonetheless, if anyone can check this branch out and test to see if your <sp>s break, that would be good.

In the meantime we should start setting up for a patch release soon. (E.g., establish Jenkins jobs.)

@ebeshero
Copy link
Member Author

ebeshero commented Sep 3, 2025

Okay, I can confirm that @sydb 's fix not only passes tests, but is also working when I build tei_all.rng and validate my test file (attached).

  • That test file currently doesn't contain a <speaker> element, and it's valid.
  • I can also position a <speaker> element in as the very first element, or after a <stage>element, or something from model.global.
  • I cannot position a <speaker> element after the spoken passge.
  • Nor can I position multiple <speaker> elements anywhere.

So I think this will suffice for a patch. But I am wondering if we really want to continue with the complexity of this new content model for <sp>.

<content>
  <sequence>
      <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
      <alternate>
        <sequence>
          <sequence minOccurs="1" maxOccurs="unbounded">
            <classRef key="model.stageLike" minOccurs="1" maxOccurs="1"/>
            <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
          <alternate>
            <sequence>
              <elementRef key="speaker" minOccurs="1" maxOccurs="1"/>
              <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
              <sequence minOccurs="1" maxOccurs="unbounded">
                <alternate minOccurs="1" maxOccurs="1">
                  <elementRef key="lg"/>
                  <classRef key="model.lLike"/>
                  <classRef key="model.pLike"/>
                  <classRef key="model.listLike"/>
                  <classRef key="model.attributable"/>
                  <elementRef key="q"/>
                  <classRef key="model.stageLike"/>
                </alternate>
                <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </sequence>
            <sequence>
              <alternate minOccurs="1" maxOccurs="1">
                <elementRef key="lg"/>
                <classRef key="model.lLike"/>
                <classRef key="model.pLike"/>
                <classRef key="model.listLike"/>
                <classRef key="model.attributable"/>
                <elementRef key="q"/>
              </alternate>
              <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
              <sequence minOccurs="0" maxOccurs="unbounded">
                <alternate minOccurs="1" maxOccurs="1">
                  <elementRef key="lg"/>
                  <classRef key="model.lLike"/>
                  <classRef key="model.pLike"/>
                  <classRef key="model.listLike"/>
                  <classRef key="model.attributable"/>
                  <elementRef key="q"/>
                  <classRef key="model.stageLike"/>
                </alternate>
                <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
              </sequence>
            </sequence>
          </alternate>
        </sequence>
        <sequence>
          <elementRef key="speaker" minOccurs="1" maxOccurs="1"/>
          <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
          <sequence minOccurs="1" maxOccurs="unbounded">
            <alternate minOccurs="1" maxOccurs="1">
              <elementRef key="lg"/>
              <classRef key="model.lLike"/>
              <classRef key="model.pLike"/>
              <classRef key="model.listLike"/>
              <classRef key="model.attributable"/>
              <elementRef key="q"/>
              <classRef key="model.stageLike"/>
            </alternate>
            <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
        </sequence>
        <sequence>
          <alternate minOccurs="1" maxOccurs="1">
            <elementRef key="lg"/>
            <classRef key="model.lLike"/>
            <classRef key="model.pLike"/>
            <classRef key="model.listLike"/>
            <classRef key="model.attributable"/>
            <elementRef key="q"/>
          </alternate>
          <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
          <sequence minOccurs="0" maxOccurs="unbounded">
            <alternate minOccurs="1" maxOccurs="1">
              <elementRef key="lg"/>
              <classRef key="model.lLike"/>
              <classRef key="model.pLike"/>
              <classRef key="model.listLike"/>
              <classRef key="model.attributable"/>
              <elementRef key="q"/>
              <classRef key="model.stageLike"/>
            </alternate>
            <classRef key="model.global" minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
        </sequence>
      </alternate>
    </sequence>
 
  </content>

Is it too much? Would introducing model.stageLike to model.global allow a simpler solution?

sp-speaker-testing.xml

@ebeshero
Copy link
Member Author

ebeshero commented Sep 3, 2025

Also @sydb , whether you take that as a review or not, I think in the interests of time, any one of us should review your solution on this branch. The fact that I made the branch shouldn't matter at this point. I will argue that a simpler content model might be desirable for human readability. Whether mine is too simple depends on how imperative we find constraining the position of <speaker> to ensure it can't come after the spoken portion of a speech.

@sydb
Copy link
Member

sydb commented Sep 3, 2025

Keep in mind the content model is a lot simpler after we create the “spPart_con” and “spPart_sans” classes (or macros), whatever they may be named.
My instinct is to do the emergency patch release without the nicety of the new classes for the sake of expediency. Then we can work on the classes, deciding on their description, names, etc., at our leisure over the next month or three.

@sydb
Copy link
Member

sydb commented Sep 3, 2025

BTW, I do not think this PR should be accepted as-is — the changes in "ebb-fix-#​2758" should be merged into a new "release-4.10.2" branch, not "dev" (which is what this PR would do).
@ebeshero, do you want to change this PR, create a new one, talk me into merging directly into "dev", or override my objection and merge directly into "dev"?

@lb42
Copy link
Member

lb42 commented Sep 3, 2025

Adding stage to model.global would permit retaining the constraint that speaker if present must precede what is spoken which i think is important. And is obviously much simpler.

@sydb
Copy link
Member

sydb commented Sep 3, 2025

The proposed content model requires <speaker> to precede what is spoken, or at least it is supposed to. And @ebeshero’s tests say that it does.

@lb42
Copy link
Member

lb42 commented Sep 3, 2025

@sydb my point was not that the proposed content model doesn't do the jpob -- clearly it does. My point is that the same objective might be obtained with a much simpler content model , just by making stage a global element. And simplicity and consequent explainability are desirable.

@ebeshero
Copy link
Member Author

ebeshero commented Sep 4, 2025

Closing this PR since we transferred to the work of it to the 4.10.2 release branch, made from 4.10.1.

@ebeshero ebeshero closed this Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants