2
$\begingroup$

I'm a bit new to AI and I'd like to use some kind of clustering algorithm to solve a problem:

I'm trying to parse pdf documents to get headings and titles. I can parse pdf to html and I'm then able to get some information on the lines of the document. I've identified some properties that can be useful for identifying the headings.

  • font-size (int): of course it's quite usual that heading's font-size is bigger than normal text
  • font-family (string): it's possible for headings to be bold so font-family may differ
  • left property (int): it's also possible that headings are aligned a bit to the right, there's an indentation that's not always there on normal paragraphs
  • bonus boolean: I have identified some properties that I can combine to get a boolean value. When the boolean is set to true it can increase the chances of the paragraph being a heading.

Of course, these are not rules that apply to all headings. Some headings may follow some of these but not all of them. It could also be possible that some 'normal' paragraphs follow all these points, but what I've seen is that, in general, those rules where what made headings different from paragraphs.

With this information, is there a way of doing what I'm looking for? As I said, I'm new to AI even though I have a background in CS and mathematics. I thought clustering could be interesting since I'm trying to create 2 clusters: headings and normal paragraphs.

What algorithm do you think might work for this use case. Should I look outside clustering?

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to SE:AI! $\endgroup$
    – DukeZhou
    Commented Apr 17, 2020 at 21:13
  • $\begingroup$ Hi and welcome to AI SE :) I just a quick note. To attract more readers next time, try to provide a more descriptive title of your problem ;) $\endgroup$
    – nbro
    Commented Apr 18, 2020 at 0:48

2 Answers 2

2
$\begingroup$

Yes, you could use clustering: Encode your features as a feature vector and feed it into a clustering algorithm (see Finding Groups in Data for a comprehensive description of these). You could use agglomerative clustering, which would give you groups of similar items; perhaps different level headings will be clustered together.

Alternatively you could try a decision tree, something like ID3, which would also be suitable; for this you'd need some annotated training data, though. But with a small amount of data you might solve it, if your items are clearly separated.

$\endgroup$
0
0
$\begingroup$

Here im trying to answer, yes you could use clustering to parse pdf document. it similar of how the text mining works (you can read from here).

and for the clustering method, you could probably use K-NN methods, K-Means, agglomerative hierarchical clustering, and the other methods based on your preference. or u could use naive bayes alternatively.

$\endgroup$
1
  • $\begingroup$ Hi @Nicho Santoso, welcome to AI.SE, please give more details about your answer and don't just give an external link, add another explanation or summary about the content of the link so this answer will still be useful for future reader if the link is broken $\endgroup$
    – malioboro
    Commented Apr 22, 2020 at 0:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .