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
f244cb95
Commit
f244cb95
authored
Dec 22, 2011
by
Steven Bird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up import statements
parent
1806f61b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
nltk/chunk/__init__.py
+8
-7
nltk/chunk/api.py
+3
-2
nltk/cluster/__init__.py
+5
-5
No files found.
nltk/chunk/__init__.py
View file @
f244cb95
...
...
@@ -152,11 +152,12 @@ zero-length assertions).
pattern is valid.
"""
from
api
import
ChunkParserI
from
util
import
(
ChunkScore
,
accuracy
,
tagstr2tree
,
conllstr2tree
,
tree2conlltags
,
tree2conllstr
,
tree2conlltags
)
from
regexp
import
RegexpChunkParser
,
RegexpParser
import
nltk
from
nltk.data
import
load
from
nltk.chunk.api
import
ChunkParserI
from
nltk.chunk.util
import
(
ChunkScore
,
accuracy
,
tagstr2tree
,
conllstr2tree
,
tree2conlltags
,
tree2conllstr
,
tree2conlltags
)
from
nltk.chunk.regexp
import
RegexpChunkParser
,
RegexpParser
# Standard treebank POS tagger
_BINARY_NE_CHUNKER
=
'chunkers/maxent_ne_chunker/english_ace_binary.pickle'
...
...
@@ -171,7 +172,7 @@ def ne_chunk(tagged_tokens, binary=False):
chunker_pickle
=
_BINARY_NE_CHUNKER
else
:
chunker_pickle
=
_MULTICLASS_NE_CHUNKER
chunker
=
nltk
.
data
.
load
(
chunker_pickle
)
chunker
=
load
(
chunker_pickle
)
return
chunker
.
parse
(
tagged_tokens
)
def
batch_ne_chunk
(
tagged_sentences
,
binary
=
False
):
...
...
@@ -183,6 +184,6 @@ def batch_ne_chunk(tagged_sentences, binary=False):
chunker_pickle
=
_BINARY_NE_CHUNKER
else
:
chunker_pickle
=
_MULTICLASS_NE_CHUNKER
chunker
=
nltk
.
data
.
load
(
chunker_pickle
)
chunker
=
load
(
chunker_pickle
)
return
chunker
.
batch_parse
(
tagged_sentences
)
nltk/chunk/api.py
View file @
f244cb95
...
...
@@ -11,7 +11,8 @@
##//////////////////////////////////////////////////////
from
nltk.parse
import
ParserI
import
nltk
from
nltk.chunk.util
import
ChunkScore
class
ChunkParserI
(
ParserI
):
"""
...
...
@@ -43,7 +44,7 @@ class ChunkParserI(ParserI):
:param gold: The list of chunked sentences to score the chunker on.
:rtype: L{ChunkScore<nltk.chunk.util.ChunkScore>}
"""
chunkscore
=
nltk
.
chunk
.
util
.
ChunkScore
()
chunkscore
=
ChunkScore
()
for
correct
in
gold
:
chunkscore
.
score
(
correct
,
self
.
parse
(
correct
.
leaves
()))
return
chunkscore
...
...
nltk/cluster/__init__.py
View file @
f244cb95
...
...
@@ -79,8 +79,8 @@ objects. nltk_contrib.unimelb.tacohn.SparseArrays may be used for
efficiency when required.
"""
from
util
import
(
VectorSpaceClusterer
,
Dendrogram
,
euclidean_distance
,
cosine_distance
)
from
kmeans
import
KMeansClusterer
from
gaac
import
GAAClusterer
from
em
import
EMClusterer
from
nltk.cluster.
util
import
(
VectorSpaceClusterer
,
Dendrogram
,
euclidean_distance
,
cosine_distance
)
from
nltk.cluster.
kmeans
import
KMeansClusterer
from
nltk.cluster.
gaac
import
GAAClusterer
from
nltk.cluster.
em
import
EMClusterer
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