Package nltk :: Package metrics :: Module windowdiff'
[hide private]
[frames] | no frames]

Module windowdiff'

source code

Functions [hide private]
 
demo() source code
int
windowdiff(seg1, seg2, k, boundary='1')
Compute the windowdiff score for a pair of segmentations.
source code
Function Details [hide private]

windowdiff(seg1, seg2, k, boundary='1')

source code 

Compute the windowdiff score for a pair of segmentations. A segmentation is any sequence over a vocabulary of two items (e.g. "0", "1"), where the specified boundary value is used to mark the edge of a segmentation.

>>> s1 = "00000010000000001000000"
>>> s2 = "00000001000000010000000"
>>> s3 = "00010000000000000001000"
>>> windowdiff(s1, s1, 3)
0
>>> windowdiff(s1, s2, 3)
4
>>> windowdiff(s2, s3, 3)
16
Parameters:
  • seg1 (string or list) - a segmentation
  • seg2 (string or list) - a segmentation
  • k (int) - window width
  • boundary (string or int or bool) - boundary value
Returns: int