[ 
https://issues.apache.org/jira/browse/TIKA-5073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150077#comment-18150077
 ] 

ASF GitHub Bot commented on TIKA-5073:
--------------------------------------

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.)**




> Keep superscript/subscript as sup/sub in pdf
> --------------------------------------------
>
>                 Key: TIKA-5073
>                 URL: https://issues.apache.org/jira/browse/TIKA-5073
>             Project: Tika
>          Issue Type: Improvement
>            Reporter: Dylan Hoh
>            Priority: Minor
>
> TIKA-5016 added sup/sub output for Office formats, but PDFs don't record 
> superscript/subscript, so "Article 5¹" comes out as "Article 51". It can be 
> guessed from smaller text sitting above or below the line, so this would be 
> an opt-in setting, off by default.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to