Package nltk :: Package wordnet :: Package browser
[hide private]
[frames] | no frames]

Source Code for Package nltk.wordnet.browser

  1  # Natural Language Toolkit: Wordnet Browser 
  2  # 
  3  # Copyright (C) 2007-2008 NLTK Project 
  4  # Author: Jussi Salmela <[email protected]> 
  5  #         Paul Bone <[email protected]> 
  6  # URL: <http://nltk.org> 
  7  # For license information, see LICENSE.TXT 
  8   
  9  __docformat__ = 'restructuredtext en' 
 10   
 11  """ 
 12  ================================= 
 13   Details of using the 3 programs 
 14  ================================= 
 15   
 16  Production of the 'Database Info' HTML statistics page 
 17  ====================================================== 
 18       
 19      python dbinfo_html.py 
 20       
 21      Note that this takes a couple of minutes to run. 
 22   
 23   
 24  The first alternative to browse the database 
 25  ============================================ 
 26   
 27      python wxbrowse.py 
 28       
 29      This has a GUI programmed using wxPython and thus needs wxPython 
 30      to be installed. 
 31   
 32      Features of wxbrowse.py: 
 33   
 34      Some of these features apply to browserver.py 
 35   
 36       - A short help display at the start 
 37        
 38       - Notebook UI: tabsheets with independent search histories 
 39   
 40       - Menu 
 41   
 42       - File functions: page save&open, print&preview 
 43   
 44       - Tabsheet functions: open&close; start word search in a new 
 45         tabsheet 
 46   
 47       - Page history: previous&next page 
 48   
 49       - Font size adjustment: increase&decrease&normalize 
 50   
 51       - Show Database Info: 
 52   
 53         - counts of words/synsets/relations for every POS 
 54   
 55         - example words as hyperlinks, 1 word for every relation&POS 
 56           pair 
 57   
 58       - Help 
 59   
 60       - The position and size of the browser window and the font size 
 61         chosen is remembered between sessions. 
 62   
 63       - Possibility to give several words/collocations to be searched 
 64         and displayed at the same time by separating them with a comma 
 65         in search word(s) field 
 66   
 67       - Tries to deduce the stems of the search word(s) given 
 68   
 69       - Showing the parts of speech for a word typed in the search field 
 70   
 71       - Showing the parts of speech for a word clicked in one of the 
 72         synsets 
 73   
 74       - Showing the relation names for a synset when S: is clicked and 
 75         hiding them again at the second click. 
 76   
 77       - Showing the synsets for a relation. This covers most of the 
 78         relations for nouns and some relations for other POS's also. 
 79   
 80   
 81  The second alternative to browse the database 
 82  ============================================= 
 83   
 84        $ python browserver.py -p port-num 
 85       
 86      Here's what happens: 
 87       
 88          3.1 Launches the default browser (if not running) and creates 
 89               a new tab trying to make a connection to: 
 90               http://localhost:port-num/ 
 91          3.2 Starts the HTTP server for port-num and begins serving the 
 92              browsing requests for the database. 
 93                
 94      The default port-num is 8000 
 95   
 96      for more help: 
 97   
 98        $ python browserver.py -h 
 99   
100      This currently requires that the user's web browser supports 
101      Javascript. 
102   
103  """ 
104   
105  # TODO: throughout this package variable names and docstrings need 
106  # modifying to be complaint with NLTK's coding standards.  Tests also 
107  # need to be develop to ensure this continues to work in the face of 
108  # changes to other NLTK packages. 
109   
110  from browserver import demo as start_web_browser 
111  from wxbrowse import demo as start_wx_browser 
112   
113   
114 -def demo():
115 print "Use either start_web_browser or start_wx_browser"
116