Boost Interval Container Library
boost.org
boost.org
Also, the underlying implementation (http://www.boost.org/doc/libs/1_46_1/libs/icl/doc/html/boost...) relies on STL sets and maps, rather than using something more exotic like R-Trees or kd-trees, so this might spark some discussion about alternate implementations and their respective complexities.
I say might because intervals...well, don't really do it for me. Anyone have interesting applications?
And you do complex queries over these interval annotations, e.g. (for a simple example) "which sentences contain both a date and a room number".
Because of the scale of corpora, people often do the storage and queries over SQL databases rather than in-memory, but the principle is the same.