[jira] Created: (TIKA-339) HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (TIKA-339) HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided

JIRA jira@apache.org
HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided
-------------------------------------------------------------------------------------------------------------

                 Key: TIKA-339
                 URL: https://issues.apache.org/jira/browse/TIKA-339
             Project: Tika
          Issue Type: Bug
    Affects Versions: 0.6
            Reporter: Ken Krugler
            Priority: Minor
             Fix For: 0.6


Currently the code used to call CharsetDetector in both TXTParser and HtmlParser is that any incoming language in the metadata map gets replaced if the detector returns a language.

Given the low reliability of this language result, it should only be used in cases where there is no provided language, as typically this is coming in from either the Http response header or (for the HtmlParser) a meta tag or some other tag attribute. In all those cases, the incoming language is more accurate than the guess by the CharsetDetector.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (TIKA-339) HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided

JIRA jira@apache.org

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

Ken Krugler commented on TIKA-339:
----------------------------------

There's another issue here. If you add the detected language as Metadata.LANGUAGE & Metadata.CONTENT_LANGUAGE, and the HTML document contains (say) an Http-equiv meta tag, then you'll wind up with different values for the two, with no way of knowing which one is better (the one that was explicitly set by the meta tag).

So this makes me think we should punt completely on using the CharsetDetector language - if the the user cares, then they can use the ProfilingHandler to get (hopefully) more accurate results.

> HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: TIKA-339
>                 URL: https://issues.apache.org/jira/browse/TIKA-339
>             Project: Tika
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Ken Krugler
>            Priority: Minor
>             Fix For: 0.6
>
>
> Currently the code used to call CharsetDetector in both TXTParser and HtmlParser is that any incoming language in the metadata map gets replaced if the detector returns a language.
> Given the low reliability of this language result, it should only be used in cases where there is no provided language, as typically this is coming in from either the Http response header or (for the HtmlParser) a meta tag or some other tag attribute. In all those cases, the incoming language is more accurate than the guess by the CharsetDetector.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (TIKA-339) HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/TIKA-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ken Krugler updated TIKA-339:
-----------------------------

    Attachment: TIKA-339.patch

Patch that uses metadata.add(CharsetDetector language) in the TXTParser, and skips this entirely in the HtmlParser.

Plus tests.

> HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: TIKA-339
>                 URL: https://issues.apache.org/jira/browse/TIKA-339
>             Project: Tika
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Ken Krugler
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: TIKA-339.patch
>
>
> Currently the code used to call CharsetDetector in both TXTParser and HtmlParser is that any incoming language in the metadata map gets replaced if the detector returns a language.
> Given the low reliability of this language result, it should only be used in cases where there is no provided language, as typically this is coming in from either the Http response header or (for the HtmlParser) a meta tag or some other tag attribute. In all those cases, the incoming language is more accurate than the guess by the CharsetDetector.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (TIKA-339) HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/TIKA-339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting resolved TIKA-339.
--------------------------------

    Resolution: Fixed
      Assignee: Jukka Zitting

Committed in revision 890130.

> HtmlParser & TXTParser should not use language returned by CharsetDetector if language hint has been provided
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: TIKA-339
>                 URL: https://issues.apache.org/jira/browse/TIKA-339
>             Project: Tika
>          Issue Type: Bug
>    Affects Versions: 0.6
>            Reporter: Ken Krugler
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: TIKA-339.patch
>
>
> Currently the code used to call CharsetDetector in both TXTParser and HtmlParser is that any incoming language in the metadata map gets replaced if the detector returns a language.
> Given the low reliability of this language result, it should only be used in cases where there is no provided language, as typically this is coming in from either the Http response header or (for the HtmlParser) a meta tag or some other tag attribute. In all those cases, the incoming language is more accurate than the guess by the CharsetDetector.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.