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
da669e67
Commit
da669e67
authored
Feb 14, 2015
by
Steven Bird
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'parseri' into test
parents
cdcf6701
3bab2103
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
7 deletions
+10
-7
nltk/downloader.py
+4
-1
nltk/parse/pchart.py
+3
-3
nltk/parse/stanford.py
+1
-1
nltk/tag/stanford.py
+1
-1
nltk/tokenize/stanford.py
+1
-1
No files found.
nltk/downloader.py
View file @
da669e67
...
@@ -840,8 +840,11 @@ class Downloader(object):
...
@@ -840,8 +840,11 @@ class Downloader(object):
for
i
,
child_id
in
enumerate
(
collection
.
children
):
for
i
,
child_id
in
enumerate
(
collection
.
children
):
if
child_id
in
self
.
_packages
:
if
child_id
in
self
.
_packages
:
collection
.
children
[
i
]
=
self
.
_packages
[
child_id
]
collection
.
children
[
i
]
=
self
.
_packages
[
child_id
]
if
child_id
in
self
.
_collections
:
el
if
child_id
in
self
.
_collections
:
collection
.
children
[
i
]
=
self
.
_collections
[
child_id
]
collection
.
children
[
i
]
=
self
.
_collections
[
child_id
]
else
:
print
(
'removing collection member with no package: {}'
.
format
(
child_id
))
del
collection
.
children
[
i
]
# Fill in collection.packages for each collection.
# Fill in collection.packages for each collection.
for
collection
in
self
.
_collections
.
values
():
for
collection
in
self
.
_collections
.
values
():
...
...
nltk/parse/pchart.py
View file @
da669e67
...
@@ -212,7 +212,7 @@ class BottomUpProbabilisticChartParser(ParserI):
...
@@ -212,7 +212,7 @@ class BottomUpProbabilisticChartParser(ParserI):
# Initialize the chart.
# Initialize the chart.
for
edge
in
bu_init
.
apply
(
chart
,
grammar
):
for
edge
in
bu_init
.
apply
(
chart
,
grammar
):
if
self
.
_trace
>
1
:
if
self
.
_trace
>
1
:
print
(
'
%-50
s [
%
s]'
%
(
chart
.
p
p
_edge
(
edge
,
width
=
2
),
print
(
'
%-50
s [
%
s]'
%
(
chart
.
p
retty_format
_edge
(
edge
,
width
=
2
),
edge
.
prob
()))
edge
.
prob
()))
queue
.
append
(
edge
)
queue
.
append
(
edge
)
...
@@ -227,7 +227,7 @@ class BottomUpProbabilisticChartParser(ParserI):
...
@@ -227,7 +227,7 @@ class BottomUpProbabilisticChartParser(ParserI):
# Get the best edge.
# Get the best edge.
edge
=
queue
.
pop
()
edge
=
queue
.
pop
()
if
self
.
_trace
>
0
:
if
self
.
_trace
>
0
:
print
(
'
%-50
s [
%
s]'
%
(
chart
.
p
p
_edge
(
edge
,
width
=
2
),
print
(
'
%-50
s [
%
s]'
%
(
chart
.
p
retty_format
_edge
(
edge
,
width
=
2
),
edge
.
prob
()))
edge
.
prob
()))
# Apply BU & FR to it.
# Apply BU & FR to it.
...
@@ -294,7 +294,7 @@ class BottomUpProbabilisticChartParser(ParserI):
...
@@ -294,7 +294,7 @@ class BottomUpProbabilisticChartParser(ParserI):
split
=
len
(
queue
)
-
self
.
beam_size
split
=
len
(
queue
)
-
self
.
beam_size
if
self
.
_trace
>
2
:
if
self
.
_trace
>
2
:
for
edge
in
queue
[:
split
]:
for
edge
in
queue
[:
split
]:
print
(
'
%-50
s [DISCARDED]'
%
chart
.
p
p
_edge
(
edge
,
2
))
print
(
'
%-50
s [DISCARDED]'
%
chart
.
p
retty_format
_edge
(
edge
,
2
))
del
queue
[:
split
]
del
queue
[:
split
]
class
InsideChartParser
(
BottomUpProbabilisticChartParser
):
class
InsideChartParser
(
BottomUpProbabilisticChartParser
):
...
...
nltk/parse/stanford.py
View file @
da669e67
...
@@ -73,7 +73,7 @@ class StanfordParser(ParserI):
...
@@ -73,7 +73,7 @@ class StanfordParser(ParserI):
def
__init__
(
self
,
path_to_jar
=
None
,
path_to_models_jar
=
None
,
def
__init__
(
self
,
path_to_jar
=
None
,
path_to_models_jar
=
None
,
model_path
=
'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz'
,
model_path
=
'edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz'
,
encoding
=
'
UTF-
8'
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
encoding
=
'
utf
8'
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
self
.
_stanford_jar
=
find_jar
(
self
.
_stanford_jar
=
find_jar
(
self
.
_JAR
,
path_to_jar
,
self
.
_JAR
,
path_to_jar
,
...
...
nltk/tag/stanford.py
View file @
da669e67
...
@@ -36,7 +36,7 @@ class StanfordTagger(TaggerI):
...
@@ -36,7 +36,7 @@ class StanfordTagger(TaggerI):
_SEPARATOR
=
''
_SEPARATOR
=
''
_JAR
=
''
_JAR
=
''
def
__init__
(
self
,
path_to_model
,
path_to_jar
=
None
,
encoding
=
'
ascii
'
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
def
__init__
(
self
,
path_to_model
,
path_to_jar
=
None
,
encoding
=
'
utf8
'
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
if
not
self
.
_JAR
:
if
not
self
.
_JAR
:
warnings
.
warn
(
'The StanfordTagger class is not meant to be '
warnings
.
warn
(
'The StanfordTagger class is not meant to be '
...
...
nltk/tokenize/stanford.py
View file @
da669e67
...
@@ -36,7 +36,7 @@ class StanfordTokenizer(TokenizerI):
...
@@ -36,7 +36,7 @@ class StanfordTokenizer(TokenizerI):
_JAR
=
'stanford-postagger.jar'
_JAR
=
'stanford-postagger.jar'
def
__init__
(
self
,
path_to_jar
=
None
,
encoding
=
'
UTF-
8'
,
options
=
None
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
def
__init__
(
self
,
path_to_jar
=
None
,
encoding
=
'
utf
8'
,
options
=
None
,
verbose
=
False
,
java_options
=
'-mx1000m'
):
self
.
_stanford_jar
=
find_jar
(
self
.
_stanford_jar
=
find_jar
(
self
.
_JAR
,
path_to_jar
,
self
.
_JAR
,
path_to_jar
,
env_vars
=
(
'STANFORD_POSTAGGER'
,),
env_vars
=
(
'STANFORD_POSTAGGER'
,),
...
...
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