changeset 133:b1163b317cd4

handle more Replies, now using regex
author ht
date Sat, 16 Nov 2024 09:43:19 +0000
parents c352b56f8053
children d6cfe894c58b
files summa/bilingual/merge.xsl
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/summa/bilingual/merge.xsl	Sat Jul 13 18:07:47 2024 +0000
+++ b/summa/bilingual/merge.xsl	Sat Nov 16 09:43:19 2024 +0000
@@ -57,12 +57,13 @@
    <xsl:otherwise>
     <xsl:message>Can't merge article <xsl:value-of select="@id"/>, <xsl:value-of select="count(x:p)"/>!=<xsl:value-of select="count($lp)"/></xsl:message>
     <!-- Try to split on keywords in English -->
-    <xsl:variable name="pb" select="count(x:p/x:b[starts-with(.,'Objection') or (.='On the contrary,') or (.='I answer that,') or starts-with(.,'Reply to ')])"/>
+    <xsl:variable name="pb" select="count(x:p/x:b[matches(.,
+                                    '^(Objection|On the contrary,|I answer that|Reply to )')]) +  count(x:p[matches(.,'^ ?(Hence the Reply|This suffices for the Repl(y|ies))')])"/>
     <xsl:choose>
      <xsl:when test="$pb=count($lp)">
       <xsl:copy>
        <xsl:apply-templates select="@*|x:h4"/>
-       <xsl:for-each-group select="x:p" group-starting-with="x:p[x:b[starts-with(.,'Objection') or (.='On the contrary,') or (.='I answer that,') or starts-with(.,'Reply to ')]]">
+       <xsl:for-each-group select="x:p" group-starting-with="x:p[matches(x:b,'^(Objection|On the contrary,|I answer that|Reply to )') or matches(.,' ?(Hence the Reply|This suffices for the Repl(y|ies))')]">
        <xsl:variable name="i" select="position()"/>
        <xsl:call-template name="doBi">
         <xsl:with-param select="current-group()" name="english"/>