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
ca4c874f
Commit
ca4c874f
authored
Feb 07, 2013
by
David Doukhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better tests
parent
f9a895dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
nltk/metrics/segmentation.py
+6
-9
No files found.
nltk/metrics/segmentation.py
View file @
ca4c874f
...
...
@@ -191,15 +191,12 @@ def pk(ref, hyp, k=None, boundary='1'):
where the specified boundary value is used to mark the edge of a
segmentation.
>>> s1 = "00000010000000001000000"
>>> s2 = "00000001000000010000000"
>>> s3 = "00010000000000000001000"
>>> pk(s1, s1, 3)
0.0
>>> pk(s1, s2, 3)
0.095238...
>>> pk(s2, s3, 3)
0.190476...
>>> '
%.2
f'
%
pk('0100'*100, '1'*400, 2)
'0.50'
>>> '
%.2
f'
%
pk('0100'*100, '0'*400, 2)
'0.50'
>>> '
%.2
f'
%
pk('0100'*100, '0100'*100, 2)
'0.00'
:param ref: the reference segmentation
:type ref: str or list
...
...
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