def parse3From12(): PcfgFileName = 'Corpus1+Corpus2-12-Corrected.pcfg' Directors= Directors1+Directors2 try: nltk.corpus.set_basedir(system_corpora) except: system_corpora=nltk.corpus.get_basedir() logger.initLogger('ParseDirections',LogDir='MarcoLogs') import enchant from Sense import Lexicon spellchecker = enchant.DictWithPWL('en_US', Lexicon) DirParser = getDirParser(Directors, Maps, usePOSTagger, POSTaggerFileName, PcfgFileName, SenseTaggerFileName, collectStats, spellchecker=spellchecker) Directions = DirectionCorpusReader(constructItemRegexp(Directors3,Maps,mapversions='[01]')) parseTestSet(DirParser, Directions, list(Directions.items('CleanDirs')), 1)
import enchant from Sense import Lexicon spellchecker = enchant.DictWithPWL('en_US', Lexicon) DirParser = getDirParser(Directors, Maps, usePOSTagger, POSTaggerFileName, PcfgFileName, SenseTaggerFileName, collectStats, spellchecker=spellchecker) if doParses == 'Profile': import profile profile.run('testParses(DirParser)', 'parse.prof') elif doParses == 'TestSet': Directions = DirectionCorpusReader(constructItemRegexp( Directors, Maps)) parseTestSet(DirParser, Directions, TestSet, 1) elif doParses == 'CommandLine': if len(sys.argv) > 1 and sys.argv[1]: Files = sys.argv[1] else: Files = constructItemRegexp(Directors, Maps, mapversions='[01]') print 'Parsing', Files Directions = DirectionCorpusReader(Files) TestSet = list(Directions.items('CleanDirs')) #random.shuffle(TestSet); #timeSort(TestSet) parseTestSet(DirParser, Directions, TestSet, 1)
try: nltk.corpus.set_basedir(system_corpora) except: system_corpora=nltk.corpus.get_basedir() logger.initLogger('ParseDirections',LogDir='MarcoLogs') import enchant from Sense import Lexicon spellchecker = enchant.DictWithPWL('en_US', Lexicon) DirParser = getDirParser(Directors, Maps, usePOSTagger, POSTaggerFileName, PcfgFileName, SenseTaggerFileName, collectStats, spellchecker=spellchecker) if doParses == 'Profile': import profile profile.run('testParses(DirParser)','parse.prof') elif doParses == 'TestSet': Directions = DirectionCorpusReader(constructItemRegexp(Directors,Maps)) parseTestSet(DirParser,Directions,TestSet,1) elif doParses == 'CommandLine': if len(sys.argv)>1 and sys.argv[1]: Files = sys.argv[1] else: Files = constructItemRegexp(Directors,Maps,mapversions='[01]') print 'Parsing', Files Directions = DirectionCorpusReader(Files) TestSet=list(Directions.items('CleanDirs')) #random.shuffle(TestSet); #timeSort(TestSet) parseTestSet(DirParser,Directions,TestSet,1)