title: Suggestions on Word Parsing
body: <p>I have a set of folders and files that have arbitrary names. My end goal is to parse through the folders and files and create a nicely sorted and named set of folders. These titles sometimes have spaces as delimiters and sometimes have periods (I haven't found any examples with anything other than those as delimiters). I want to display these filenames without delimiters and with only the real words (specific the title of the file and a date if the date is relevant). I'm not worrying about the dates for now, I have a lookup table to figure out the dates based on the correctly spelled title.</p>
  
  <p><strong>Examples of titles</strong>:</p>
  
  <ol>
  <li><code>a.bad.title.asdf.1975</code> (where asdf is the author or website the file was scraped from). </li>
  </ol>
  
  <p><strong>The title should read:</strong> <code>A Bad Title (1975)</code></p>
  
  <ol start="2">
  <li><code>another bad title asdf.com 1975</code></li>
  </ol>
  
  <p><strong>Should read:</strong> <code>Another Bad Title (1975)</code></p>
  
  <ol start="3">
  <li><code>a really.bad title[1975]</code></li>
  </ol>
  
  <p><strong>Should read:</strong> <code>A Really Bad Title (1975)</code></p>
  
  <p><strong>What I've tried:</strong></p>
  
  <p><strong>Possible Solution:</strong> Parse through the words using the delimiters to pull out each separate word and do a word search with a large dictionary I have to figure out if the given element of the array is a word. </p>
  
  <p><strong>Problem 1:</strong> <code>A.bad.title.1975</code> becomes <code>('a', 'bad', 'title', '1975')</code> and I can work with it without a problem. However, a really.bad title[1975] becomes <code>('a', 'really', 'bad', 'title[1975]')</code> and can't be dealt with.</p>
  
  <p><strong>Problem 2:</strong> Some of the titles are numbers or parts of numbers like <code>'71</code> or <code>2012</code> or <code>2001: A Space Odyssey</code>, so I can't just parse through what real words are. </p>
  
  <p><strong>EDIT (Examples of problem 2):</strong></p>
  
  <p>Filename 1: <code>'72.2014.asdf.txt</code></p>
  
  <p>Filename 2: <code>2012 [2009].txt</code></p>
  
  <p>Filename 3: <code>2001: a.space.odyssey[1968].txt</code></p>
  
  <p><strong>END OF EDIT</strong></p>
  
  <p>In other words, my problem is that I want to be able to remove a given date or random numbers, but I want to keep the date if it pertains to the title (as some titles are dates or years) and some of the words in the title are attached (without spaces) to the year in the title and can't be parsed out.</p>
  
  <p>My last idea is possibly giving scores to each possible title based on how many words they have in common, but that still leaves the "year as a title" problem unsolved.</p>
  
  <p>If anyone has any suggestions that might help me think about this problem, please let me know!</p>