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
7ba46b9d
Commit
7ba46b9d
authored
Mar 09, 2015
by
Steven Bird
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #912 from longdt219/fix_CI_Errors
Fix errors shown in CI
parents
b62b6d15
7d12d2ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
nltk/classify/senna.py
+6
-8
nltk/parse/chart.py
+3
-2
nltk/tag/crf.py
+1
-1
No files found.
nltk/classify/senna.py
View file @
7ba46b9d
...
...
@@ -27,19 +27,17 @@ The input is:
- List of the operations needed to be performed.
- (optionally) the encoding of the input data (default:utf-8)
>>> from __future__ import unicode_literals
>>> from nltk.classify import Senna
>>> pipeline = Senna('/usr/share/senna-v2.0', ['pos', 'chk', 'ner'])
>>> sent = 'Düsseldorf is an international business center'.split()
>>> pipeline.tag(sent)
[{'word': 'D
\xfc
sseldorf', 'chk': 'B-NP', 'ner': 'B-PER', 'pos': 'NNP'},
{'word': 'is', 'chk': 'B-VP', 'ner': 'O', 'pos': 'VBZ'},
{'word': 'an', 'chk': 'B-NP', 'ner': 'O', 'pos': 'DT'},
{'word': 'international', 'chk': 'I-NP', 'ner': 'O', 'pos': 'JJ'},
{'word': 'business', 'chk': 'I-NP', 'ner': 'O', 'pos': 'NN'},
{'word': 'center', 'chk': 'I-NP', 'ner': 'O','pos': 'NN'}]
>>> sent = 'Dusseldorf is an international business center'.split()
>>> [(token['word'], token['chk'], token['ner'], token['pos']) for token in pipeline.tag(sent)]
[('Dusseldorf', 'B-NP', 'B-LOC', 'NNP'), ('is', 'B-VP', 'O', 'VBZ'), ('an', 'B-NP', 'O', 'DT'),
('international', 'I-NP', 'O', 'JJ'), ('business', 'I-NP', 'O', 'NN'), ('center', 'I-NP', 'O', 'NN')]
"""
from
__future__
import
unicode_literals
from
os
import
path
,
sep
,
environ
from
subprocess
import
Popen
,
PIPE
from
platform
import
architecture
,
system
...
...
nltk/parse/chart.py
View file @
7ba46b9d
...
...
@@ -1313,7 +1313,7 @@ class ChartParser(ParserI):
# Width, for printing trace edges.
trace_edge_width
=
self
.
_trace_chart_width
//
(
chart
.
num_leaves
()
+
1
)
if
trace
:
print
(
chart
.
pretty_format_leaves
(
trace_edge_width
))
if
self
.
_use_agenda
:
# Use an agenda-based algorithm.
for
axiom
in
self
.
_axioms
:
...
...
@@ -1628,8 +1628,9 @@ def demo(choice=None,
print
()
cp
=
ChartParser
(
grammar
,
strategies
[
strategy
][
1
],
trace
=
trace
)
t
=
time
.
time
()
parses
=
cp
.
parse_all
(
tokens
)
chart
=
cp
.
chart_parse
(
tokens
)
parses
=
list
(
chart
.
parses
(
grammar
.
start
()))
times
[
strategies
[
strategy
][
0
]]
=
time
.
time
()
-
t
print
(
"Nr edges in chart:"
,
len
(
chart
.
edges
()))
if
numparses
:
...
...
nltk/tag/crf.py
View file @
7ba46b9d
...
...
@@ -24,7 +24,7 @@ class CRFTagger(TaggerI):
"""
A module for POS tagging using CRFSuite https://pypi.python.org/pypi/python-crfsuite
>>> from nltk.tag.crf
suite
import CRFTagger
>>> from nltk.tag.crf import CRFTagger
>>> ct = CRFTagger()
>>> train_data = [[('University','Noun'), ('is','Verb'), ('a','Det'), ('good','Adj'), ('place','Noun')],
...
...
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