我試圖導入語料庫,只有從一個文件夾需要txt
文件如果文本文件是從2009年開始的文件名都是格式如下:使用正則表達式來查找文件
Mr. ABERCROMBIE.2009-01-14.2014sep17_at_223226.txt
我需要用連字符分隔的第一個日期是2009年。我試圖寫出正則表達式(下面),但我真的很難找出正則表達式,下面的東西不起作用。
corpus_root = '/Users/jt/Documents/CRspeeches'
speeches = PlaintextCorpusReader(corpus_root, '\w.2009-[0-9]-[0-9].*\.txt')
http://regexpal.com/ – jgr208 2014-10-18 22:58:53
'2009- [0-9] {1,2} - [0-9] {1,2}'您需要處理2位數日期的情況/月 – scunliffe 2014-10-18 23:00:25