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

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

DylanSYHoh commented on PR #3654:
URL: https://github.com/apache/tika/pull/3654#issuecomment-7160564818

   > I get worried any time we add heuristics to PDFs. My agent ran this 
against 785 PDFs and found the following.
   > 
   > ```
   > - Flag off vs plain main: 784 of 785 files give byte-identical XHTML.
   >   - The one difference comes from the second commit, which fixes a 
separate bug (double space where an artifact is cut out of a tagged paragraph). 
In gs_0280.pdf, Area Code (  ) becomes Area Code ( ). That code runs
   >     by default, since markedContent defaults to AUTO.
   >   - Flag on vs flag off: text output is identical on all 785 files, and 
the XHTML is identical once the <sup>/<sub> tags are stripped. The feature only 
adds tags and never moves or changes text.
   >   - detectAngles users get one other off-path change: the glyph's text 
matrix is no longer mutated in place. The computed angle is the same by my 
reading, but neither my scan nor the PR's one angle test compares
   >     angle-mode output against main.
   > 
   >   How good is the guess when it's on?
   >   - 138 of 785 files got tags, 7,006 spans in total.
   >   - Spans of 1–3 characters are 82% of spans and mostly right: footnote 
markers, math subscripts, table-note letters, ®. In my 40-span sample roughly 
three quarters were correct.
   >   - Spans over 10 characters hold 68% of all tagged characters, sit in 31 
files, and are mostly wrong. Typical cases are a table label cell (<sup>Lot 
Number:</sup>, <sup>SHA256 thumbprint:</sup>), a calendar row of
   >     dates, and raised bullets.
   >   - 278 of those long spans are an entire output line. The docs say a line 
of only smaller text is left alone, but the comparison is against the 
stripper's line, which can span table cells of different sizes and
   >     baselines.
   > 
   >   What I'd ask for
   >   1. Split the artifact double-space fix into its own JIRA and PR. It is a 
default-on behaviour change to a shipped path, and without it this PR is a 
no-op by default.
   >   2. Mark the option experimental in pdf-parser.adoc, and correct the 
"line made only of smaller text" sentence.
   >   3. Decide whether to cap span length. A cap (say, no tag on a run longer 
than about 10 characters) would remove most of the false positives measured 
here. It is one more heuristic on the stack, so if you'd rather
   >      not, ship it as is and document the table-cell failure.
   > ```
   > 
   > I think we should definitely consider a cap of like 3 characters max, but 
that's all just gut feeling.... yet more heuristics.
   
   Thanks Tim. I've added the 3-character cap you suggested. I think it's a 
good call. I've also made the changes your agent suggested and moved the 
artifact double-space fix into its own issue, #3677, which should probably go 
in first.
   
   Thanks again for all your help with these PRs.




> 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