Coder Social home page Coder Social logo

Comments (5)

adbar avatar adbar commented on June 6, 2024

I may use different heuristics but this is open for debate.

from trafilatura.

pieterhartel avatar pieterhartel commented on June 6, 2024

Well, I tried to summarise what trafilatura is currently doing, could you confirm or correct please?

from trafilatura.

adbar avatar adbar commented on June 6, 2024

My bad, I answered question 2.

Title extraction roughly works as you described in your list, with two additional steps:

  • First and foremost HTML meta or JSON information is used when available
  • Tag attributes are used in some cases, not only tags themselves, e.g. @class="entry-title"

from trafilatura.

pieterhartel avatar pieterhartel commented on June 6, 2024

I have a dataset with over 10M home pages, of which 82K (less than 1%) contain a @class="entry-title". WP is not popular in this dataset.
75K pages contain a <h1 class="entry-title">, 56K a h2, 18K a h3.
For my dataset h1 and h2 are sufficient.

I'll figure out next how many pages contain a <meta name="description" content="...">

from trafilatura.

adbar avatar adbar commented on June 6, 2024

That's interesting, feel free to share results if you find anything else, I patched together a series of heuristics but I lack the time to evaluate them properly. Besides, the quick searches I run on my data may also be biased so it's useful to try them on yours.

The manually curated list of X-Path expressions to extract titles is here:

title_xpaths = [

    '//*[(self::h1 or self::h2)][contains(@class, "post-title") or contains(@class, "entry-title") or contains(@class, "headline") or contains(@id, "headline") or contains(@itemprop, "headline") or contains(@class, "post__title") or contains(@class, "article-title")]',
    '//*[@class="entry-title" or @class="post-title"]',
    '//*[(self::h1 or self::h2 or self::h3)][contains(@class, "title") or contains(@id, "title")]',

from trafilatura.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.