<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project xmlns:dita="http://dita-ot.sourceforge.net">
    
    <path id="org.doctales.terminology.path">    
        <pathelement path="dost.class.path"/>
        <pathelement location="${dita.plugin.org.doctales.terminology.dir}/lib/xmltask.jar"/>
        <pathelement location="lib/xmltask.jar"/>
        <pathelement location="${dita.dir}/plugins/org.doctales.terminology/lib/xmltask.jar"/>
    </path>
    
    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="org.doctales.terminology.path"/>

    <target name="is.com.oxygen.webhelp.available">
        <fail message="The plugin com.oxygen.webhelp is not available">
            <condition>
                <not>
                    <isset property="dita.plugin.com.oxygenxml.dita-ot.plugin.webhelp.dir"/>
                </not>
            </condition>
        </fail>
    </target>
    <target name="dita2termbrowser" depends="is.com.oxygen.webhelp.available">
        <antcall target="dita2webhelp"/>
        <antcall target="termbrowser-termstats"/>
        <antcall target="semanticnet"/>
    </target>
    <target name="dita2termbrowser-responsive" depends="is.com.oxygen.webhelp.available">
        <antcall target="dita2webhelp-responsive"/>
        <antcall target="termbrowser-termstats"/>
        <antcall target="semanticnet"/>
    </target>
    <target name="dita2termbrowser-html5">
        <antcall target="dita2html5"/>
        <antcall target="termbrowser-termstats"/>
        <antcall target="semanticnet"/>
    </target>
    <target name="termbrowser-termstats"
        description="Generate terminology statistics.">
        
        <condition property="termmap" value="${args.term.containermap}">
            <isset property="args.term.containermap"/>
        </condition>
        
        <condition property="termmap" value="${args.input}">
            <not>
                <isset property="args.term.containermap"/>
            </not>
        </condition>
        
        <echo level="info">termmap=${termmap}</echo>
        
        <basename property="basename" file="${args.input}" suffix=".ditamap"/>
        <basename property="termmap.basename" file="${termmap}" suffix=".ditamap"/>
        
        
        <!--<property name="dita.temp.dir.rel" value="${dita.temp.dir}" relative="yes"/>-->
        <property name="dita.temp.dir.abs" location="${dita.temp.dir}"/>
        <makeurl file="${dita.temp.dir.abs}" property="dita.temp.dir.abs.url"/>
        <property name="dita.map.rel" value="${dita.temp.dir}${file.separator}${termmap.basename}.ditamap" relative="no"/>
        
        <!-- Convert terminology statistics to termstats XML -->
        <xslt basedir="${dita.temp.dir}"
            destdir="${output.dir}"
            in="${dita.temp.dir}${file.separator}${termmap.basename}.ditamap"
            out="${dita.temp.dir}${file.separator}terminology_stats.xml"
            reloadstylesheet="${dita.xhtml.reloadstylesheet}"
            classpathref="dost.class.path"
            extension="_check.xml"
            style="${dita.plugin.org.doctales.terminology.dir}/xsl/terminology-stats.xsl"
            filenameparameter="FILENAME" 
            filedirparameter="FILEDIR">
            <param name="ditamap" expression="${dita.map.rel}"/>
            <param name="ditamap.filename" expression="${basename}.ditamap"/>
            <param name="temp.dir" expression="${dita.temp.dir}"/>
            <param name="temp.dir.abs" expression="${dita.temp.dir.abs.url}"/>
            <xmlcatalog refid="dita.catalog"/>
        </xslt>
        
        <antcall target="termstats-merge"/>
        
        <!--
            Convert the XML data to XHTML.
            The content of the <head> element and the <body> element
            will later be injected into the termstats topic.
        -->
        <fail unless="args.default.language">'args.default.language' is not set, e.g. to 'en-GB'</fail>
        <xslt basedir="${dita.temp.dir}"
            destdir="${output.dir}"
            in="${dita.temp.dir}/termstats_merged.xml"
            out="${dita.temp.dir}${file.separator}terminology_stats.html"
            reloadstylesheet="${dita.xhtml.reloadstylesheet}"
            classpathref="dost.class.path"
            extension=".html"
            style="${dita.plugin.org.doctales.terminology.dir}/xsl/terminology-stats-xml2html.xsl"
            filenameparameter="FILENAME" 
            filedirparameter="FILEDIR">
            <param name="outext" expression="${args.outext}"/>
            <param name="language" expression="${args.default.language}"/>
            <xmlcatalog refid="dita.catalog"/>
        </xslt>
        
        <!-- Copy the XML file to the output dir. It has to be shipped with the webhelp to be used as an input parameter for the next publication. -->
        <copy file="${dita.temp.dir}/termstats_merged.xml" tofile="${output.dir}/termstats.xml"/>
        
        <!--<loadfile srcFile="${dita.temp.dir}${file.separator}terminology_stats.html" property="terminology_stats.head">
            <filterchain>
                <replaceregex pattern="\s\s+" replace=" "/>
                <trim/>
                <ignoreblank/>
                <striplinebreaks/>
                <replaceregex pattern="(.*)&lt;!-\-HEAD BEGINNING-\-&gt;" replace=""/>
                <replaceregex pattern="&lt;!-\-HEAD END-\-&gt;(.*)" replace=""/>
            </filterchain>
        </loadfile>-->
        <!--<echo>terminology_stats.head=${terminology_stats.head}</echo>-->
        
        <loadfile srcFile="${dita.temp.dir}${file.separator}terminology_stats.html" property="terminology_stats.body">
            <filterchain><commit_msg>Fix property issues<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project xmlns:dita="http://dita-ot.sourceforge.net">
    
    <path id="org.doctales.terminology.path">    
        <pathelement path="dost.class.path"/>
        <pathelement location="${dita.plugin.org.doctales.terminology.dir}/lib/xmltask.jar"/>
        <pathelement location="lib/xmltask.jar"/>
        <pathelement location="${dita.dir}/plugins/org.doctales.terminology/lib/xmltask.jar"/>
    </path>
    
    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpathref="org.doctales.terminology.path"/>

    <target name="is.com.oxygen.webhelp.available">
        <fail message="The plugin com.oxygen.webhelp is not available">
            <condition>
                <not>
                    <isset property="dita.plugin.com.oxygenxml.dita-ot.plugin.webhelp.dir"/>
                </not>
            </condition>
        </fail>
    </target>

    <target name="dita2termbrowser" depends="is.com.oxygen.webhelp.available, dita2webhelp, termbrowser-termstats, semanticnet"/>
    <target name="dita2termbrowser-responsive" depends="is.com.oxygen.webhelp.available, dita2webhelp-responsive, termbrowser-termstats, semanticnet"/>
    <target name="dita2termbrowser-html5" depends="dita2html5, termbrowser-termstats, semanticnet"/>
    
    <target name="termbrowser-termstats" description="Generate terminology statistics.">
        
        <condition property="termmap" value="${args.term.containermap}">
            <isset property="args.term.containermap"/>
        </condition>
        
        <condition property="termmap" value="${args.input}">
            <not>
                <isset property="args.term.containermap"/>
            </not>
        </condition>
        
        <echo level="info">termmap=${termmap}</echo>
        
        <basename property="basename" file="${args.input}" suffix=".ditamap"/>
        <basename property="termmap.basename" file="${termmap}" suffix=".ditamap"/>
        
        <property name="dita.temp.dir.abs" location="${dita.temp.dir}"/>
        <makeurl file="${dita.temp.dir.abs}" property="dita.temp.dir.abs.url"/>
        <property name="dita.map.rel" value="${dita.temp.dir}${file.separator}${termmap.basename}.ditamap" relative="no"/>
        
        <!-- Convert terminology statistics to termstats XML -->
        <xslt basedir="${dita.temp.dir}"
            destdir="${output.dir}"
            in="${dita.temp.dir}${file.separator}${termmap.basename}.ditamap"
            out="${dita.temp.dir}${file.separator}terminology_stats.xml"
            reloadstylesheet="${dita.xhtml.reloadstylesheet}"
            classpathref="dost.class.path"
            extension="_check.xml"
            style="${dita.plugin.org.doctales.terminology.dir}/xsl/terminology-stats.xsl"
            filenameparameter="FILENAME" 
            filedirparameter="FILEDIR">
            <param name="ditamap" expression="${dita.map.rel}"/>
            <param name="ditamap.filename" expression="${basename}.ditamap"/>
            <param name="temp.dir" expression="${dita.temp.dir}"/>
            <param name="temp.dir.abs" expression="${dita.temp.dir.abs.url}"/>
            <xmlcatalog refid="dita.catalog"/>
        </xslt>
        
        <antcall target="termstats-merge"/>
        
        <!--
            Convert the XML data to XHTML.
            The content of the <head> element and the <body> element
            will later be injected into the termstats topic.
        -->
        <fail unless="args.default.language">'args.default.language' is not set, e.g. to 'en-GB'</fail>
        <xslt basedir="${dita.temp.dir}"
            destdir="${output.dir}"
            in="${dita.temp.dir}/termstats_merged.xml"
            out="${dita.temp.dir}${file.separator}terminology_stats.html"
            reloadstylesheet="${dita.xhtml.reloadstylesheet}"
            classpathref="dost.class.path"
            extension=".html"
            style="${dita.plugin.org.doctales.terminology.dir}/xsl/terminology-stats-xml2html.xsl"
            filenameparameter="FILENAME" 
            filedirparameter="FILEDIR">
            <param name="outext" expression="${args.outext}"/>
            <param name="language" expression="${args.default.language}"/>
            <xmlcatalog refid="dita.catalog"/>
        </xslt>
        
        <!-- Copy the XML file to the output dir. It has to be shipped with the webhelp to be used as an input parameter for the next publication. -->
        <copy file="${dita.temp.dir}/termstats_merged.xml" tofile="${output.dir}/termstats.xml"/>
        
        <loadfile srcFile="${dita.temp.dir}${file.separator}terminology_stats.html" property="terminology_stats.body">
            <filterchain>
{'fraction_non_alphanumeric': 0.1608351606444847, 'fraction_numerical': 0.0022881113547525977, 'mean_word_length': 2.501335113484646, 'pattern_counts': {'":': 0, '<': 151, '<?xml version=': 2, '>': 151, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 32}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1990563', 'n_tokens_mistral': 3141, 'n_tokens_neox': 3055, 'n_words': 464}