Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
46eea71f
Commit
46eea71f
authored
Nov 28, 2011
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaned up wildcard imports
parent
7862c9db
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
104 additions
and
81 deletions
+104
-81
nltk/app/chartparser_app.py
+9
-4
nltk/app/chunkparser_app.py
+7
-1
nltk/app/collocations_app.py
+26
-21
nltk/app/concordance_app.py
+31
-26
nltk/app/rdparser_app.py
+7
-5
nltk/app/srparser_app.py
+8
-6
nltk/chat/__init__.py
+1
-1
nltk/chat/eliza.py
+1
-1
nltk/chat/iesha.py
+1
-1
nltk/chat/rude.py
+1
-1
nltk/chat/suntsu.py
+1
-1
nltk/chat/zen.py
+1
-1
nltk/cluster/__init__.py
+2
-1
nltk/draw/cfg.py
+4
-5
nltk/draw/tree.py
+3
-4
nltk/draw/util.py
+1
-2
No files found.
nltk/app/chartparser_app.py
View file @
46eea71f
...
@@ -44,14 +44,19 @@ import Tkinter
...
@@ -44,14 +44,19 @@ import Tkinter
import
math
import
math
import
string
import
string
import
os.path
import
os.path
import
tkFont
,
tkMessageBox
from
nltk.parse.chart
import
*
from
nltk.parse.chart
import
(
BottomUpPredictCombineRule
,
BottomUpPredictRule
,
Chart
,
LeafEdge
,
LeafInitRule
,
SingleEdgeFundamentalRule
,
SteppingChartParser
,
TopDownInitRule
,
TopDownPredictRule
,
TreeEdge
)
from
nltk.tree
import
Tree
from
nltk.tree
import
Tree
from
nltk.grammar
import
Nonterminal
,
parse_cfg
from
nltk.grammar
import
Nonterminal
,
parse_cfg
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.draw.util
import
*
from
nltk.draw.util
import
(
CanvasFrame
,
ColorizedList
,
from
nltk.draw.cfg
import
CFGEditor
EntryDialog
,
MutableOptionMenu
,
from
nltk.draw.tree
import
tree_to_treesegment
,
TreeSegmentWidget
ShowText
,
SymbolWidget
)
from
nltk.draw
import
CFGEditor
,
tree_to_treesegment
,
TreeSegmentWidget
# Known bug: ChartView doesn't handle edges generated by epsilon
# Known bug: ChartView doesn't handle edges generated by epsilon
# productions (e.g., [Production: PP -> ]) very well.
# productions (e.g., [Production: PP -> ]) very well.
...
...
nltk/app/chunkparser_app.py
View file @
46eea71f
...
@@ -21,11 +21,17 @@ import time
...
@@ -21,11 +21,17 @@ import time
import
textwrap
import
textwrap
import
re
import
re
import
random
import
random
import
tkFileDialog
,
tkFont
from
Tkinter
import
(
Button
,
Canvas
,
Checkbutton
,
Frame
,
IntVar
,
Label
,
Menu
,
Scrollbar
,
Text
,
Tk
)
import
nltk
import
nltk
from
nltk.tree
import
Tree
from
nltk.tree
import
Tree
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.draw.util
import
*
from
nltk.draw.util
import
ShowText
class
RegexpChunkApp
(
object
):
class
RegexpChunkApp
(
object
):
"""
"""
...
...
nltk/app/collocations_app.py
View file @
46eea71f
...
@@ -7,12 +7,17 @@
...
@@ -7,12 +7,17 @@
#
#
import
threading
import
threading
import
tkFont
from
Tkinter
import
(
Button
,
END
,
Frame
,
IntVar
,
LEFT
,
Label
,
Menu
,
OptionMenu
,
SUNKEN
,
Scrollbar
,
StringVar
,
Text
,
Tk
)
import
nltk
from
nltk.corpus
import
(
cess_cat
,
brown
,
nps_chat
,
treebank
,
sinica_treebank
,
alpino
,
indian
,
floresta
,
mac_morpho
,
machado
,
cess_esp
)
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.probability
import
FreqDist
from
nltk.probability
import
FreqDist
from
nltk.text
import
Text
as
TextDomain
from
nltk.text
import
Text
as
TextDomain
from
nltk.draw.util
import
*
CORPUS_LOADED_EVENT
=
'<<CL_EVENT>>'
CORPUS_LOADED_EVENT
=
'<<CL_EVENT>>'
ERROR_LOADING_CORPUS_EVENT
=
'<<ELC_EVENT>>'
ERROR_LOADING_CORPUS_EVENT
=
'<<ELC_EVENT>>'
...
@@ -20,39 +25,39 @@ ERROR_LOADING_CORPUS_EVENT = '<<ELC_EVENT>>'
...
@@ -20,39 +25,39 @@ ERROR_LOADING_CORPUS_EVENT = '<<ELC_EVENT>>'
_DEFAULT
=
'English: Brown Corpus (Humor)'
_DEFAULT
=
'English: Brown Corpus (Humor)'
_CORPORA
=
{
_CORPORA
=
{
'Catalan: CESS-CAT Corpus'
:
'Catalan: CESS-CAT Corpus'
:
lambda
:
nltk
.
corpus
.
cess_cat
.
words
(),
lambda
:
cess_cat
.
words
(),
'English: Brown Corpus'
:
'English: Brown Corpus'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(),
lambda
:
brown
.
words
(),
'English: Brown Corpus (Press)'
:
'English: Brown Corpus (Press)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
[
'news'
,
'editorial'
,
'reviews'
]),
lambda
:
brown
.
words
(
categories
=
[
'news'
,
'editorial'
,
'reviews'
]),
'English: Brown Corpus (Religion)'
:
'English: Brown Corpus (Religion)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
'religion'
),
lambda
:
brown
.
words
(
categories
=
'religion'
),
'English: Brown Corpus (Learned)'
:
'English: Brown Corpus (Learned)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
'learned'
),
lambda
:
brown
.
words
(
categories
=
'learned'
),
'English: Brown Corpus (Science Fiction)'
:
'English: Brown Corpus (Science Fiction)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
'science_fiction'
),
lambda
:
brown
.
words
(
categories
=
'science_fiction'
),
'English: Brown Corpus (Romance)'
:
'English: Brown Corpus (Romance)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
'romance'
),
lambda
:
brown
.
words
(
categories
=
'romance'
),
'English: Brown Corpus (Humor)'
:
'English: Brown Corpus (Humor)'
:
lambda
:
nltk
.
corpus
.
brown
.
words
(
categories
=
'humor'
),
lambda
:
brown
.
words
(
categories
=
'humor'
),
'English: NPS Chat Corpus'
:
'English: NPS Chat Corpus'
:
lambda
:
n
ltk
.
corpus
.
n
ps_chat
.
words
(),
lambda
:
nps_chat
.
words
(),
'English: Wall Street Journal Corpus'
:
'English: Wall Street Journal Corpus'
:
lambda
:
nltk
.
corpus
.
treebank
.
words
(),
lambda
:
treebank
.
words
(),
'Chinese: Sinica Corpus'
:
'Chinese: Sinica Corpus'
:
lambda
:
nltk
.
corpus
.
sinica_treebank
.
words
(),
lambda
:
sinica_treebank
.
words
(),
'Dutch: Alpino Corpus'
:
'Dutch: Alpino Corpus'
:
lambda
:
nltk
.
corpus
.
alpino
.
words
(),
lambda
:
alpino
.
words
(),
'Hindi: Indian Languages Corpus'
:
'Hindi: Indian Languages Corpus'
:
lambda
:
nltk
.
corpus
.
indian
.
words
(
files
=
'hindi.pos'
),
lambda
:
indian
.
words
(
files
=
'hindi.pos'
),
'Portuguese: Floresta Corpus (Portugal)'
:
'Portuguese: Floresta Corpus (Portugal)'
:
lambda
:
nltk
.
corpus
.
floresta
.
words
(),
lambda
:
floresta
.
words
(),
'Portuguese: MAC-MORPHO Corpus (Brazil)'
:
'Portuguese: MAC-MORPHO Corpus (Brazil)'
:
lambda
:
nltk
.
corpus
.
mac_morpho
.
words
(),
lambda
:
mac_morpho
.
words
(),
'Portuguese: Machado Corpus (Brazil)'
:
'Portuguese: Machado Corpus (Brazil)'
:
lambda
:
nltk
.
corpus
.
machado
.
words
(),
lambda
:
machado
.
words
(),
'Spanish: CESS-ESP Corpus'
:
'Spanish: CESS-ESP Corpus'
:
lambda
:
nltk
.
corpus
.
cess_esp
.
words
(),
lambda
:
cess_esp
.
words
()
}
}
class
CollocationsView
:
class
CollocationsView
:
...
@@ -321,8 +326,8 @@ class CollocationsModel:
...
@@ -321,8 +326,8 @@ class CollocationsModel:
print
e
print
e
self
.
model
.
notify_listeners
(
ERROR_LOADING_CORPUS_EVENT
)
self
.
model
.
notify_listeners
(
ERROR_LOADING_CORPUS_EVENT
)
def
collocations
():
#
def collocations():
colloc_strings
=
[
w1
+
' '
+
w2
for
w1
,
w2
in
self
.
_collocations
[:
num
]]
#
colloc_strings = [w1 + ' ' + w2 for w1, w2 in self._collocations[:num]]
def
app
():
def
app
():
c
=
CollocationsView
()
c
=
CollocationsView
()
...
...
nltk/app/concordance_app.py
View file @
46eea71f
...
@@ -9,10 +9,15 @@
...
@@ -9,10 +9,15 @@
import
re
import
re
import
threading
import
threading
import
tkFont
from
Tkinter
import
(
Tk
,
Button
,
END
,
Entry
,
Frame
,
IntVar
,
LEFT
,
Label
,
Menu
,
OptionMenu
,
SUNKEN
,
Scrollbar
,
StringVar
,
Text
)
import
nltk
from
nltk.corpus
import
(
cess_cat
,
brown
,
nps_chat
,
treebank
,
sinica_treebank
,
alpino
,
indian
,
floresta
,
mac_morpho
,
cess_esp
)
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.draw.util
import
*
from
nltk.draw.util
import
ShowText
WORD_OR_TAG
=
'[^/ ]+'
WORD_OR_TAG
=
'[^/ ]+'
BOUNDARY
=
r'\b'
BOUNDARY
=
r'\b'
...
@@ -28,53 +33,53 @@ ERROR_LOADING_CORPUS_EVENT = '<<ELC_EVENT>>'
...
@@ -28,53 +33,53 @@ ERROR_LOADING_CORPUS_EVENT = '<<ELC_EVENT>>'
_DEFAULT
=
'English: Brown Corpus (Humor, simplified)'
_DEFAULT
=
'English: Brown Corpus (Humor, simplified)'
_CORPORA
=
{
_CORPORA
=
{
'Catalan: CESS-CAT Corpus (simplified)'
:
'Catalan: CESS-CAT Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
cess_cat
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
cess_cat
.
tagged_sents
(
simplify_tags
=
True
),
'English: Brown Corpus'
:
'English: Brown Corpus'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(),
lambda
:
brown
.
tagged_sents
(),
'English: Brown Corpus (simplified)'
:
'English: Brown Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
simplify_tags
=
True
),
'English: Brown Corpus (Press, simplified)'
:
'English: Brown Corpus (Press, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
[
'news'
,
'editorial'
,
'reviews'
],
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
[
'news'
,
'editorial'
,
'reviews'
],
simplify_tags
=
True
),
'English: Brown Corpus (Religion, simplified)'
:
'English: Brown Corpus (Religion, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
'religion'
,
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
'religion'
,
simplify_tags
=
True
),
'English: Brown Corpus (Learned, simplified)'
:
'English: Brown Corpus (Learned, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
'learned'
,
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
'learned'
,
simplify_tags
=
True
),
'English: Brown Corpus (Science Fiction, simplified)'
:
'English: Brown Corpus (Science Fiction, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
'science_fiction'
,
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
'science_fiction'
,
simplify_tags
=
True
),
'English: Brown Corpus (Romance, simplified)'
:
'English: Brown Corpus (Romance, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
'romance'
,
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
'romance'
,
simplify_tags
=
True
),
'English: Brown Corpus (Humor, simplified)'
:
'English: Brown Corpus (Humor, simplified)'
:
lambda
:
nltk
.
corpus
.
brown
.
tagged_sents
(
categories
=
'humor'
,
simplify_tags
=
True
),
lambda
:
brown
.
tagged_sents
(
categories
=
'humor'
,
simplify_tags
=
True
),
'English: NPS Chat Corpus'
:
'English: NPS Chat Corpus'
:
lambda
:
n
ltk
.
corpus
.
n
ps_chat
.
tagged_posts
(),
lambda
:
nps_chat
.
tagged_posts
(),
'English: NPS Chat Corpus (simplified)'
:
'English: NPS Chat Corpus (simplified)'
:
lambda
:
n
ltk
.
corpus
.
n
ps_chat
.
tagged_posts
(
simplify_tags
=
True
),
lambda
:
nps_chat
.
tagged_posts
(
simplify_tags
=
True
),
'English: Wall Street Journal Corpus'
:
'English: Wall Street Journal Corpus'
:
lambda
:
nltk
.
corpus
.
treebank
.
tagged_sents
(),
lambda
:
treebank
.
tagged_sents
(),
'English: Wall Street Journal Corpus (simplified)'
:
'English: Wall Street Journal Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
treebank
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
treebank
.
tagged_sents
(
simplify_tags
=
True
),
'Chinese: Sinica Corpus'
:
'Chinese: Sinica Corpus'
:
lambda
:
nltk
.
corpus
.
sinica_treebank
.
tagged_sents
(),
lambda
:
sinica_treebank
.
tagged_sents
(),
'Chinese: Sinica Corpus (simplified)'
:
'Chinese: Sinica Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
sinica_treebank
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
sinica_treebank
.
tagged_sents
(
simplify_tags
=
True
),
'Dutch: Alpino Corpus'
:
'Dutch: Alpino Corpus'
:
lambda
:
nltk
.
corpus
.
alpino
.
tagged_sents
(),
lambda
:
alpino
.
tagged_sents
(),
'Dutch: Alpino Corpus (simplified)'
:
'Dutch: Alpino Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
alpino
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
alpino
.
tagged_sents
(
simplify_tags
=
True
),
'Hindi: Indian Languages Corpus'
:
'Hindi: Indian Languages Corpus'
:
lambda
:
nltk
.
corpus
.
indian
.
tagged_sents
(
files
=
'hindi.pos'
),
lambda
:
indian
.
tagged_sents
(
files
=
'hindi.pos'
),
'Hindi: Indian Languages Corpus (simplified)'
:
'Hindi: Indian Languages Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
indian
.
tagged_sents
(
files
=
'hindi.pos'
,
simplify_tags
=
True
),
lambda
:
indian
.
tagged_sents
(
files
=
'hindi.pos'
,
simplify_tags
=
True
),
'Portuguese: Floresta Corpus (Portugal)'
:
'Portuguese: Floresta Corpus (Portugal)'
:
lambda
:
nltk
.
corpus
.
floresta
.
tagged_sents
(),
lambda
:
floresta
.
tagged_sents
(),
'Portuguese: Floresta Corpus (Portugal, simplified)'
:
'Portuguese: Floresta Corpus (Portugal, simplified)'
:
lambda
:
nltk
.
corpus
.
floresta
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
floresta
.
tagged_sents
(
simplify_tags
=
True
),
'Portuguese: MAC-MORPHO Corpus (Brazil)'
:
'Portuguese: MAC-MORPHO Corpus (Brazil)'
:
lambda
:
nltk
.
corpus
.
mac_morpho
.
tagged_sents
(),
lambda
:
mac_morpho
.
tagged_sents
(),
'Portuguese: MAC-MORPHO Corpus (Brazil, simplified)'
:
'Portuguese: MAC-MORPHO Corpus (Brazil, simplified)'
:
lambda
:
nltk
.
corpus
.
mac_morpho
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
mac_morpho
.
tagged_sents
(
simplify_tags
=
True
),
'Spanish: CESS-ESP Corpus (simplified)'
:
'Spanish: CESS-ESP Corpus (simplified)'
:
lambda
:
nltk
.
corpus
.
cess_esp
.
tagged_sents
(
simplify_tags
=
True
),
lambda
:
cess_esp
.
tagged_sents
(
simplify_tags
=
True
),
}
}
class
ConcordanceSearchView
(
object
):
class
ConcordanceSearchView
(
object
):
...
...
nltk/app/rdparser_app.py
View file @
46eea71f
...
@@ -67,13 +67,15 @@ Keyboard Shortcuts::
...
@@ -67,13 +67,15 @@ Keyboard Shortcuts::
"""
"""
import
string
import
string
import
tkFont
from
Tkinter
import
(
Listbox
,
IntVar
,
Button
,
Frame
,
Label
,
Menu
,
Scrollbar
,
Tk
)
import
nltk
from
nltk.tree
import
Tree
from
nltk.tree
import
Tree
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.
draw.util
import
*
from
nltk.
parse
import
SteppingRecursiveDescentParser
from
nltk.draw.
tree
import
*
from
nltk.draw.
util
import
TextWidget
,
ShowText
,
CanvasFrame
,
EntryDialog
from
nltk.draw
.cfg
import
*
from
nltk.draw
import
CFGEditor
,
TreeSegmentWidget
,
tree_to_treesegment
class
RecursiveDescentApp
(
object
):
class
RecursiveDescentApp
(
object
):
"""
"""
...
@@ -87,7 +89,7 @@ class RecursiveDescentApp(object):
...
@@ -87,7 +89,7 @@ class RecursiveDescentApp(object):
"""
"""
def
__init__
(
self
,
grammar
,
sent
,
trace
=
0
):
def
__init__
(
self
,
grammar
,
sent
,
trace
=
0
):
self
.
_sent
=
sent
self
.
_sent
=
sent
self
.
_parser
=
nltk
.
parse
.
SteppingRecursiveDescentParser
(
grammar
,
trace
)
self
.
_parser
=
SteppingRecursiveDescentParser
(
grammar
,
trace
)
# Set up the main window.
# Set up the main window.
self
.
_top
=
Tk
()
self
.
_top
=
Tk
()
...
...
nltk/app/srparser_app.py
View file @
46eea71f
...
@@ -76,14 +76,16 @@ Possible future improvements:
...
@@ -76,14 +76,16 @@ Possible future improvements:
"""
"""
import
string
import
string
import
tkFont
from
Tkinter
import
(
IntVar
,
Listbox
,
Button
,
Frame
,
Label
,
Menu
,
Scrollbar
,
Tk
)
import
nltk
from
nltk.tree
import
Tree
from
nltk.parse
import
SteppingShiftReduceParser
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.draw.util
import
*
from
nltk.draw.util
import
CanvasFrame
,
EntryDialog
,
ShowText
,
TextWidget
from
nltk.draw.tree
import
*
from
nltk.draw
import
CFGEditor
,
TreeSegmentWidget
,
tree_to_treesegment
from
nltk.draw.cfg
import
CFGEditor
class
ShiftReduceApp
(
object
):
class
ShiftReduceApp
(
object
):
"""
"""
A graphical tool for exploring the shift-reduce parser. The tool
A graphical tool for exploring the shift-reduce parser. The tool
...
@@ -96,7 +98,7 @@ class ShiftReduceApp(object):
...
@@ -96,7 +98,7 @@ class ShiftReduceApp(object):
"""
"""
def
__init__
(
self
,
grammar
,
sent
,
trace
=
0
):
def
__init__
(
self
,
grammar
,
sent
,
trace
=
0
):
self
.
_sent
=
sent
self
.
_sent
=
sent
self
.
_parser
=
nltk
.
parse
.
SteppingShiftReduceParser
(
grammar
,
trace
)
self
.
_parser
=
SteppingShiftReduceParser
(
grammar
,
trace
)
# Set up the main window.
# Set up the main window.
self
.
_top
=
Tk
()
self
.
_top
=
Tk
()
...
...
nltk/chat/__init__.py
View file @
46eea71f
...
@@ -16,7 +16,7 @@ These chatbots may not work using the windows command line or the
...
@@ -16,7 +16,7 @@ These chatbots may not work using the windows command line or the
windows IDLE GUI.
windows IDLE GUI.
"""
"""
from
util
import
*
from
util
import
Chat
from
eliza
import
eliza_chat
from
eliza
import
eliza_chat
from
iesha
import
iesha_chat
from
iesha
import
iesha_chat
from
rude
import
rude_chat
from
rude
import
rude_chat
...
...
nltk/chat/eliza.py
View file @
46eea71f
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
# a translation table used to convert things you say into things the
# a translation table used to convert things you say into things the
# computer says back, e.g. "I am" --> "you are"
# computer says back, e.g. "I am" --> "you are"
from
util
import
*
from
util
import
Chat
,
reflections
# a table of response pairs, where each pair consists of a
# a table of response pairs, where each pair consists of a
# regular expression, and a list of possible responses,
# regular expression, and a list of possible responses,
...
...
nltk/chat/iesha.py
View file @
46eea71f
...
@@ -11,7 +11,7 @@ anime junky that frequents YahooMessenger or MSNM.
...
@@ -11,7 +11,7 @@ anime junky that frequents YahooMessenger or MSNM.
All spelling mistakes and flawed grammar are intentional.
All spelling mistakes and flawed grammar are intentional.
"""
"""
from
util
import
*
from
util
import
Chat
reflections
=
{
reflections
=
{
"am"
:
"r"
,
"am"
:
"r"
,
...
...
nltk/chat/rude.py
View file @
46eea71f
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# URL: <http://www.nltk.org/>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# For license information, see LICENSE.TXT
from
util
import
*
from
util
import
Chat
,
reflections
pairs
=
(
pairs
=
(
(
r'We (.*)'
,
(
r'We (.*)'
,
...
...
nltk/chat/suntsu.py
View file @
46eea71f
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
# URL: <http://www.nltk.org/>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# For license information, see LICENSE.TXT
from
util
import
*
from
util
import
Chat
,
reflections
"""
"""
Tsu bot responds to all queries with a Sun Tsu sayings
Tsu bot responds to all queries with a Sun Tsu sayings
...
...
nltk/chat/zen.py
View file @
46eea71f
...
@@ -36,7 +36,7 @@ respond to a question by asking a different question, in much the same way
...
@@ -36,7 +36,7 @@ respond to a question by asking a different question, in much the same way
as Eliza.
as Eliza.
"""
"""
from
util
import
*
from
util
import
Chat
,
reflections
# responses are matched top to bottom, so non-specific matches occur later
# responses are matched top to bottom, so non-specific matches occur later
# for each match, a list of possible responses is provided
# for each match, a list of possible responses is provided
...
...
nltk/cluster/__init__.py
View file @
46eea71f
...
@@ -79,7 +79,8 @@ objects. nltk_contrib.unimelb.tacohn.SparseArrays may be used for
...
@@ -79,7 +79,8 @@ objects. nltk_contrib.unimelb.tacohn.SparseArrays may be used for
efficiency when required.
efficiency when required.
"""
"""
from
util
import
VectorSpaceClusterer
,
Dendrogram
from
util
import
(
VectorSpaceClusterer
,
Dendrogram
,
euclidean_distance
,
cosine_distance
)
from
kmeans
import
KMeansClusterer
from
kmeans
import
KMeansClusterer
from
gaac
import
GAAClusterer
from
gaac
import
GAAClusterer
from
em
import
EMClusterer
from
em
import
EMClusterer
nltk/draw/cfg.py
View file @
46eea71f
...
@@ -52,16 +52,15 @@ Operations:
...
@@ -52,16 +52,15 @@ Operations:
import
re
import
re
from
Tkinter
import
(
Button
,
Canvas
,
ColorizedList
,
from
Tkinter
import
(
Button
,
Canvas
,
Entry
,
Frame
,
IntVar
,
Label
,
Entry
,
Frame
,
IntVar
,
Label
,
Scrollbar
,
Scrollbar
,
Text
,
Tk
,
Toplevel
)
ShowText
,
SymbolWidget
,
Text
,
TextWidget
,
Tk
,
Toplevel
)
from
nltk.grammar
import
(
ContextFreeGrammar
,
parse_cfg_production
,
from
nltk.grammar
import
(
ContextFreeGrammar
,
parse_cfg_production
,
Nonterminal
,
nonterminals
)
Nonterminal
,
nonterminals
)
from
nltk.tree
import
Tree
from
nltk.tree
import
Tree
from
nltk.draw.tree
import
TreeSegmentWidget
,
tree_to_treesegment
from
nltk.draw.tree
import
TreeSegmentWidget
,
tree_to_treesegment
form
nltk
.
draw
.
util
import
CanvasFrame
from
nltk.draw.util
import
(
CanvasFrame
,
ColorizedList
,
ShowText
,
SymbolWidget
,
TextWidget
)
######################################################################
######################################################################
# Production List
# Production List
...
...
nltk/draw/tree.py
View file @
46eea71f
...
@@ -13,13 +13,12 @@ Graphically display a Tree.
...
@@ -13,13 +13,12 @@ Graphically display a Tree.
import
sys
import
sys
from
Tkinter
import
(
BoxWidget
,
CanvasFrame
,
IntVar
,
from
Tkinter
import
IntVar
,
Menu
,
Tk
Menu
,
OvalWidget
,
ParenWidget
,
TextWidget
,
Tk
,
canvas
)
from
nltk.util
import
in_idle
from
nltk.util
import
in_idle
from
nltk.tree
import
Tree
from
nltk.tree
import
Tree
from
nltk.draw.util
import
CanvasWidget
from
nltk.draw.util
import
(
CanvasFrame
,
CanvasWidget
,
BoxWidget
,
TextWidget
,
ParenWidget
,
OvalWidget
)
##//////////////////////////////////////////////////////
##//////////////////////////////////////////////////////
## Tree Segment
## Tree Segment
...
...
nltk/draw/util.py
View file @
46eea71f
...
@@ -37,8 +37,7 @@ homepage<http://www.ags.uni-sb.de/~konrad/clig.html>}.
...
@@ -37,8 +37,7 @@ homepage<http://www.ags.uni-sb.de/~konrad/clig.html>}.
"""
"""
from
Tkinter
import
(
Button
,
Canvas
,
Entry
,
Frame
,
Label
,
Menu
,
Menubutton
,
from
Tkinter
import
(
Button
,
Canvas
,
Entry
,
Frame
,
Label
,
Menu
,
Menubutton
,
RAISED
,
Scrollbar
,
StringVar
,
Text
,
Tk
,
Toplevel
,
RAISED
,
Scrollbar
,
StringVar
,
Text
,
Tk
,
Toplevel
,
Widget
)
Widget
,
value
)
import
tkFont
,
tkMessageBox
,
tkFileDialog
import
tkFont
,
tkMessageBox
,
tkFileDialog
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment