Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix with accompanying test for issue #300, mishandling of U_A78F. #301

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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