<commit_before><%@page import="com.vionto.vithesaurus.tools.StringTools" %>
<%@page import="java.util.regex.Pattern" %>
<%@page import="java.util.regex.Matcher" %>

    <g:if test="${synsetList.size() == 0}">
        <div class="metaInfo" style="margin-top:8px;margin-bottom:4px">
            <g:message code="result.ajax.no.exact.matches.for" args="${[params.q.toString()?.encodeAsHTML()]}"/>
        </div>
    </g:if>
    <g:else>
        <%
        Pattern directPattern = Pattern.compile("\\b(" + params.q.encodeAsHTML() + ")\\b", Pattern.CASE_INSENSITIVE);
        %>
        <g:each in="${synsetList}" status="i" var="synset">
            <div style="margin-top:4px;margin-bottom:10px">
                 <g:set var="firstVal" value="${true}"/>
                 <g:if test="${i < 10}">
                   <g:each in="${synset?.otherTerms()?.sort()}" var="term">
                       <g:set var="match" value='${term.toString()?.toLowerCase()}'/>
                       <g:set var="cleanedMatch" value='${StringTools.normalize(match).equalsIgnoreCase(params.q)}'/>
                       <g:if test="${!firstVal}">
                          <span class="d">&middot;</span>
                       </g:if>
                       <%
                       Matcher directMatcher = directPattern.matcher(term.toString().encodeAsHTML());
                       String directMatchingTerm = directMatcher.replaceAll("<span class=\"synsetmatchDirect\">\$1</span>");
                       %>
                       <g:link url="${createLinkTo(dir:'synonyme')}/${term.toString().encodeAsURL()}">
                           ${directMatchingTerm}<commit_msg>fix highlighting for terms with umlaut (e.g. "über")<commit_after><%@page import="com.vionto.vithesaurus.tools.StringTools" %>
<%@page import="java.util.regex.Pattern" %>
<%@page import="java.util.regex.Matcher" %>

    <g:if test="${synsetList.size() == 0}">
        <div class="metaInfo" style="margin-top:8px;margin-bottom:4px">
            <g:message code="result.ajax.no.exact.matches.for" args="${[params.q.toString()?.encodeAsHTML()]}"/>
        </div>
    </g:if>
    <g:else>
        <%
        Pattern directPattern = Pattern.compile("\\b(" + params.q + ")\\b", Pattern.CASE_INSENSITIVE);
        %>
        <g:each in="${synsetList}" status="i" var="synset">
            <div style="margin-top:4px;margin-bottom:10px">
                 <g:set var="firstVal" value="${true}"/>
                 <g:if test="${i < 10}">
                   <g:each in="${synset?.otherTerms()?.sort()}" var="term">
                       <g:set var="match" value='${term.toString()?.toLowerCase()}'/>
                       <g:set var="cleanedMatch" value='${StringTools.normalize(match).equalsIgnoreCase(params.q)}'/>
                       <g:if test="${!firstVal}">
                          <span class="d">&middot;</span>
                       </g:if>
                       <%
                       Matcher directMatcher = directPattern.matcher(term.toString());
                       String directMatchingTerm = directMatcher.replaceAll("___beginhighlight___\$1___endhighlight___");
                       directMatchingTerm = directMatchingTerm.encodeAsHTML();
                       directMatchingTerm = directMatchingTerm.replace("___beginhighlight___", "<span class=\"synsetmatchDirect\">");
                       directMatchingTerm = directMatchingTerm.replace("___endhighlight___", "</span>");
                       %>
                       <g:link url="${createLinkTo(dir:'synonyme')}/${term.toString().encodeAsURL()}">
                           ${directMatchingTerm}
{'fraction_non_alphanumeric': 0.18429752066115704, 'fraction_numerical': 0.0049586776859504135, 'mean_word_length': 2.16564952048823, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3425636', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1034, 'n_words': 134}