I'm currently working on semantic analysis and had a question about text organization and structure.

Are there any algorithms, or statistical / machine-learning models that weight the importance of a word or n-gram based on it's position in the global text ?

I'm asking this question because I'm looking for a way to improve the score of titles, (sub)-chapter names, section names, list elements, table headers, etc.


2 Answers 2


This is tricky. Often times, the actual position of a word is not that useful in enhancing any kind of recall you want to do on the document. But you could, for instance, create features around them as you already call out (titles/chapter names/table headers) etc. If your model is a bag of words model, you could try something simple as expand the number of words by a factor of $N$, where $N$ itself is a function of where that word figured. For example if your document looks like

Title: Tutorial
Chapter: Hello World
Content: how to write a basic Perl program

you could use a function that replicates all words in a title 3 times, in chapter heading two times keeping he rest as is. So the above document would get mapped as

tutorial tutorial tutorial hello hello world world how to write a basic perl program

hope that helps


You could model this as a lexicalized probabilistic context free grammar with extra lexical rules. Apart from rules like $man \rightarrow the$ you also have rules like $chapter1 \rightarrow man$ and $end \rightarrow chapter2$. Since this is a lexicalization you chose to specify, nothing prevents you from providing extra rules despite to partition the text in some sense.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.