DylanSYHoh commented on PR #3654:
URL: https://github.com/apache/tika/pull/3654#issuecomment-7121411684
> At `212f9f2`, toggling `detectSuperscriptSubscript` on the same tagged PDF
changed the space count between `1` and `B` in `ToTextContentHandler`’s output:
>
> ```
> off: "Article 1 B"
> on: "Article 1 B"
> ```
>
> The test writes `Article `, a superscript `1`, and a literal trailing
space in one `P`. It then writes `x y` inside an `/Artifact` and resumes the
same `P` with `B`. Both runs used the tagged path with zero fallback pages.
With detection on, the XHTML correctly contains `<sup>1</sup>`.
>
> Could `endsWithSeparator()` recognize the trailing space consistently
whether it shares a text chunk with `1` or sits in its own chunk?
>
> I used AI to help trace the difference and run the test.
While I was testing this, I realized this is actually an existing edge-case
bug on main:
if an artifact (header, footer, page number) sits mid-paragraph and there's
already a space next to it, Tika adds a second one, e.g. "Article 1 B".
Whether it does depends on whether the artifact text has a space in it:
"Article " + [x y] + "B" -> "Article B" (two spaces)
"Article " + [12] + "B" -> "Article B" (no extra space because
the artifact has no space)
"Article " + [Chapter 3] + "B" -> "Article B" (two spaces)
"Article" + [Chapter 3] + " B" -> "Article B" (two spaces)
This is now fixed in my latest commit, so it's now "Article 1 B" with
detection on or off. **inputs with detection off will have slight different
behavior now (due to the above described scenario.)**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]