Group Abstract Group Abstract

Message Boards Message Boards

Automatically-generated timelines

Posted 10 years ago

enter image description here

Inspired by the recent Wolfram Blog post, I created a program that automatically generates timelines based on mentions of notable events in Wikipedia articles. Try it out below:

generateAutoTimeline[text_String] := 
 Block[{yearsentences}, 
  yearsentences = 
   Select[TextSentences[text], 
    StringMatchQ[#, 
      RegularExpression[".*?(?:I|i)n (\\d{4}).*?\\."]] &]; 
  TimelinePlot[
   Tooltip[DateObject[{ToExpression@
         StringCases[#, RegularExpression["\\d{4}"]][[1]]}], #] & /@ 
    yearsentences]]

generateAutoTimeline[WikipediaData["Natural language processing"]]

Timeline of notable events in natural language processing

POSTED BY: Jesse Friedman
6 Replies

I just recently used this again, such a useful function! I needed to scan a long historic Wikipedia article and focus on dates only. This did all job for me, worked like a charm. Two minor suggestions:

  • to inherit options of TimelinePlot, something like PlotLayout -> "Vertical" would work;
  • to add to Wolfram Function Repository :-)

Thanks, Jesse, this idea already saved me a lot of time.

POSTED BY: Vitaliy Kaurov

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD

Very cool idea! And it works for topics you might not expect it to be useful for:

frog timeline screenshot

This is very neat idea Jesse. Do you mean that

Select[TextSentences[nlp], StringMatchQ[#, RegularExpression[".*?(?:I|i)n (\\d{4}).*?\\."]] &]

is more robust in finding sentences with year dates then given in blog method

TextCases[nlp, Containing["Sentence", "Number"]]

I am not that familiar with regex. Could you explain briefly how to read

RegularExpression[".*?(?:I|i)n (\\d{4}).*?\\."]
POSTED BY: Sam Carrettie
POSTED BY: Jesse Friedman

Thanks, Jesse, very instructive !

POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard