Skip to content

Commit

Permalink
Fix with accompanying test.
Browse files Browse the repository at this point in the history
  • Loading branch information
martindholmes committed May 6, 2024
1 parent 80bf327 commit b8e6906
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/apostrophes.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
<cite>Martin Porter, "The apostrophe character," <a href="http://snowball.tartarus.org/texts/apostrophe.html">http://snowball.tartarus.org/texts/apostrophe.html</a></cite>
<p>This additional paragraph contains a couple of other test items for the tokenizer, including a word containing a combining diaeresis (U+0308, for issue #164). For this we have invented a word which must use a combining diacritic rather than a precomposed character because the precomposed character does not exist; this helps to avoid inadvertent composition. The word puc̈ist is made up for this purpose, along with the word puq̈uist.</p>

<p>We also add here a test for the character U+A78F, the Latin Sinological Dot, which
is supposed to be a letter character, so should not cause a word to be broken during
tokenization. This is the teꞏst.</p>

</div>
</body>
</html>
16 changes: 16 additions & 0 deletions test/testJs/testJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ tests.push({
}
});

//One word search word-internal sinological dot search
tests.push({
setup: function () {
Sch.queryBox.value = "teꞏst";
},
check: function (num) {
console.log("Search hook " + num);
console.log(`Testing results for word with word - internal sinological dot "teꞏst".`);
checkResults({
docsFound: 1,
contextsFound: 1,
scoreTotal: 1
})
}
});

//One word possessive apostrophe search
tests.push({
setup: function () {
Expand Down
6 changes: 4 additions & 2 deletions xsl/tokenize.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@
<xd:desc>Regex to match alphanumeric words. Note that we use
Unicode character classes to take our best shot at splitting on
word boundaries, but this is bound to be fragile where multiple
languages are involved.</xd:desc>
languages are involved. NOTE: character U+A78F is introduced explicitly,
although it should be covered by \p{L}, because of an apparent bug in
Java or Saxon regex processing; see GH issue #200.</xd:desc>
</xd:doc>
<xsl:variable name="alphanumeric">[\p{L}\p{M}<xsl:value-of select="string-join($allApos,'')"/>]+</xsl:variable>
<xsl:variable name="alphanumeric">[&#xA78F;\p{L}\p{M}<xsl:value-of select="string-join($allApos,'')"/>]+</xsl:variable>

<xd:doc>
<xd:desc>Regex to match hyphenated words</xd:desc>
Expand Down

0 comments on commit b8e6906

Please sign in to comment.