Package jazzparser :: Package utils :: Package nltk
[hide private]
[frames] | no frames]

Source Code for Package jazzparser.utils.nltk

 1  """Jazz Parser extensions to NLTK classes. 
 2   
 3  NLTK is optionally used by the Jazz Parser. 
 4  This module provides extensions to NLTK classes. You shouldn't load  
 5  anything from this package unless you're willing to have errors  
 6  raised in the case that NLTK isn't installed, alerting the user that  
 7  they can't use this feature without NLTK. 
 8   
 9  NLTK is imported initially here so that it gets tested when the  
10  module is loaded. 
11   
12  Note: the way the codebase is currently setup, you'd never not have NLTK  
13  installed (it's an external). However, it's theoretically nice to keep  
14  stuff the depends directly on NLTK separate so that we can handle its  
15  absence graciously. 
16   
17  """ 
18  """ 
19  ============================== License ======================================== 
20   Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding 
21    
22   This file is part of The Jazz Parser. 
23    
24   The Jazz Parser is free software: you can redistribute it and/or modify 
25   it under the terms of the GNU General Public License as published by 
26   the Free Software Foundation, either version 3 of the License, or 
27   (at your option) any later version. 
28    
29   The Jazz Parser is distributed in the hope that it will be useful, 
30   but WITHOUT ANY WARRANTY; without even the implied warranty of 
31   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
32   GNU General Public License for more details. 
33    
34   You should have received a copy of the GNU General Public License 
35   along with The Jazz Parser.  If not, see <http://www.gnu.org/licenses/>. 
36   
37  ============================ End license ====================================== 
38   
39  """ 
40  __author__ = "Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>"  
41   
42   
43  from jazzparser.utils.base import load_optional_package 
44  # Check NLTK can be imported 
45  load_optional_package('nltk', 'NLTK', "load the Jazz Parser NLTK extensions") 
46   
47  from .storage import FreqDistStorer, ConditionalProbDistStorer, MLEProbDistStorer, \ 
48                  ConditionalFreqDistStorer, LaplaceProbDistStorer, \ 
49                  WittenBellProbDistStorer, GoodTuringProbDistStorer, \ 
50                  DictionaryProbDistStorer, DictionaryConditionalProbDistStorer, \ 
51                  MutableProbDistStorer 
52  from .hmm import HiddenMarkovModelTaggerStorer 
53  from .probability import CutoffFreqDistStorer, CutoffConditionalFreqDistStorer 
54   
55  # Any storers defined should be listed here 
56  # See the storage module for more info about these 
57  STORERS = [ 
58      HiddenMarkovModelTaggerStorer, 
59      FreqDistStorer, 
60      ConditionalProbDistStorer, 
61      MLEProbDistStorer, 
62      ConditionalFreqDistStorer, 
63      LaplaceProbDistStorer, 
64      WittenBellProbDistStorer, 
65      GoodTuringProbDistStorer, 
66      CutoffFreqDistStorer, 
67      CutoffConditionalFreqDistStorer, 
68      DictionaryProbDistStorer, 
69      DictionaryConditionalProbDistStorer, 
70      MutableProbDistStorer, 
71  ] 
72