Package jazzparser :: Package formalisms :: Package base :: Package semantics :: Module timetools
[hide private]
[frames] | no frames]

Source Code for Module jazzparser.formalisms.base.semantics.timetools

 1  """Interactive shell tools for a temporal semantics. 
 2   
 3  Any formalism that uses a temporal semantics (see temporal.py) may  
 4  want to use the shell tools defined here. 
 5   
 6  """ 
 7  """ 
 8  ============================== License ======================================== 
 9   Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding 
10    
11   This file is part of The Jazz Parser. 
12    
13   The Jazz Parser is free software: you can redistribute it and/or modify 
14   it under the terms of the GNU General Public License as published by 
15   the Free Software Foundation, either version 3 of the License, or 
16   (at your option) any later version. 
17    
18   The Jazz Parser is distributed in the hope that it will be useful, 
19   but WITHOUT ANY WARRANTY; without even the implied warranty of 
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
21   GNU General Public License for more details. 
22    
23   You should have received a copy of the GNU General Public License 
24   along with The Jazz Parser.  If not, see <http://www.gnu.org/licenses/>. 
25   
26  ============================ End license ====================================== 
27   
28  """ 
29  __author__ = "Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>"  
30   
31  from jazzparser.shell import tools 
32   
33 -class TimeOutputTool(tools.Tool):
34 """ 35 Toggles full time output. 36 """ 37 name = "Time Output" 38 commands = ['timeoutput'] 39 usage = ("timeoutput", "toggle output of times associated with every semantic object, "\ 40 "or just tonal denotations.") 41 help = """ 42 Toggles display of times in output. By default times are only displayed 43 alongside semantic literals, but times are stored for other items in 44 the semantics. If time output is turned on, times will be displayed for 45 every semantic object that stores a time. 46 47 This will also cause the keys of the time assignments to be displayed in 48 the form key:time. This is mainly for debugging: in general the times 49 will be ordered by key, so you can assume that the ith time in each 50 assignment has the same key. 51 """ 52
53 - def run(self, args, state):
54 from jazzparser import settings 55 if settings.OPTIONS.OUTPUT_ALL_TIMES: 56 print "Turning time output off" 57 else: 58 print "Turning time output on" 59 settings.OPTIONS.OUTPUT_ALL_TIMES = not settings.OPTIONS.OUTPUT_ALL_TIMES
60