Package nltk
[hide private]
[frames] | no frames]

Source Code for Package nltk

  1  # Natural Language Toolkit (NLTK) 
  2  # 
  3  # Copyright (C) 2001-2011 NLTK Project 
  4  # Authors: Steven Bird <sb@csse.unimelb.edu.au> 
  5  #          Edward Loper <edloper@gradient.cis.upenn.edu> 
  6  # URL: <http://nltk.org/> 
  7  # For license information, see LICENSE.TXT 
  8   
  9  """ 
 10  NLTK -- the Natural Language Toolkit -- is a suite of open source 
 11  Python modules, data sets and tutorials supporting research and 
 12  development in natural language processing. 
 13   
 14  @version: 2.0.1rc1 
 15  """ 
 16   
 17  ##////////////////////////////////////////////////////// 
 18  ##  Metadata 
 19  ##////////////////////////////////////////////////////// 
 20   
 21  # Version.  For each new release, the version number should be updated 
 22  # here and in the Epydoc comment (above). 
 23  __version__ = "2.0.1rc1" 
 24   
 25  # Copyright notice 
 26  __copyright__ = """\ 
 27  Copyright (C) 2001-2011 NLTK Project. 
 28   
 29  Distributed and Licensed under the Apache License, Version 2.0, 
 30  which is included by reference. 
 31  """ 
 32   
 33  __license__ = "Apache License, Version 2.0" 
 34  # Description of the toolkit, keywords, and the project's primary URL. 
 35  __longdescr__ = """\ 
 36  The Natural Language Toolkit (NLTK) is a Python package for 
 37  processing natural language text.  NLTK requires Python 2.4 or higher.""" 
 38  __keywords__ = ['NLP', 'CL', 'natural language processing', 
 39                  'computational linguistics', 'parsing', 'tagging', 
 40                  'tokenizing', 'syntax', 'linguistics', 'language', 
 41                  'natural language', 'text analytics'] 
 42  __url__ = "http://nltk.org/" 
 43   
 44  # Maintainer, contributors, etc. 
 45  __maintainer__ = "Steven Bird, Edward Loper, Ewan Klein" 
 46  __maintainer_email__ = "sb@csse.unimelb.edu.au" 
 47  __author__ = __maintainer__ 
 48  __author_email__ = __maintainer_email__ 
 49   
 50  # "Trove" classifiers for Python Package Index. 
 51  __classifiers__ = [ 
 52      'Development Status :: 5 - Production/Stable', 
 53      'Intended Audience :: Developers', 
 54      'Intended Audience :: Education', 
 55      'Intended Audience :: Information Technology', 
 56      'Intended Audience :: Science/Research', 
 57      'License :: OSI Approved :: Apache Software License', 
 58      'Operating System :: OS Independent', 
 59      'Programming Language :: Python :: 2.4', 
 60      'Programming Language :: Python :: 2.5', 
 61      'Programming Language :: Python :: 2.6', 
 62      'Topic :: Scientific/Engineering', 
 63      'Topic :: Scientific/Engineering :: Artificial Intelligence', 
 64      'Topic :: Scientific/Engineering :: Human Machine Interfaces', 
 65      'Topic :: Scientific/Engineering :: Information Analysis', 
 66      'Topic :: Text Processing', 
 67      'Topic :: Text Processing :: Filters', 
 68      'Topic :: Text Processing :: General', 
 69      'Topic :: Text Processing :: Indexing', 
 70      'Topic :: Text Processing :: Linguistic', 
 71      ] 
 72   
 73  from internals import config_java 
 74   
 75  ########################################################### 
 76  # TOP-LEVEL MODULES 
 77  ########################################################### 
 78   
 79  # Import top-level functionality into top-level namespace 
 80   
 81  from compat import * 
 82  from containers import * 
 83  from collocations import * 
 84  from decorators import decorator, memoize 
 85  from featstruct import * 
 86  from grammar import * 
 87  from olac import * 
 88  from probability import * 
 89  from text import * 
 90  from tree import * 
 91  from util import * 
 92  from yamltags import * 
 93   
 94  # Modules that require Python 2.6 
 95  from sys import version_info as vi 
 96  if vi[0] == 2 and vi[1] >= 6: 
 97      from align import * 
 98   
 99  # don't import contents into top-level namespace: 
100   
101  import ccg 
102  import data 
103  import help 
104   
105  ########################################################### 
106  # PACKAGES 
107  ########################################################### 
108   
109  # Processing packages -- these define __all__ carefully. 
110   
111  import chunk;     from chunk import * 
112  import classify;  from classify import * 
113  import inference; from inference import * 
114  import metrics;   from metrics import * 
115  import model;     from model import * 
116  import parse;     from parse import * 
117  import tag;       from tag import * 
118  import tokenize;  from tokenize import * 
119  import sem;       from sem import * 
120  import stem;      from stem import * 
121   
122  # Packages which can be lazily imported 
123  # (a) we don't import * 
124  # (b) they're slow to import or have run-time dependencies 
125  #     that can safely fail at run time 
126   
127  import lazyimport 
128  app = lazyimport.LazyModule('app', locals(), globals()) 
129  chat = lazyimport.LazyModule('chat', locals(), globals()) 
130  corpus = lazyimport.LazyModule('corpus', locals(), globals()) 
131  draw = lazyimport.LazyModule('draw', locals(), globals()) 
132  toolbox = lazyimport.LazyModule('toolbox', locals(), globals()) 
133   
134  try: 
135      import numpy 
136  except ImportError: 
137      pass 
138  else: 
139      import cluster; from cluster import * 
140   
141  from downloader import download, download_shell 
142  try: 
143      import Tkinter 
144  except ImportError: 
145      pass 
146  else: 
147      try: 
148          from downloader import download_gui 
149      except RuntimeError, e: 
150          import warnings 
151          warnings.warn("Corpus downloader GUI not loaded " 
152                        "(RuntimeError during import: %s" % str(e)) 
153   
154  # override any accidentally imported demo 
155 -def demo():
156 print "To run the demo code for a module, type nltk.module.demo()"
157