Exemplo n.º 1
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('abc')])
    >>> chunks = [ first, Chunk([Word('ab'),Word('b')]), Chunk([Word('a'),Word('b'),Word('c')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    """    
    return takehighest(chunks, lambda x:x.averageLength())
Exemplo n.º 2
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('ab'),Word('b',frequency=3200626),Word('ab')])
    >>> chunks = [ first, Chunk([Word('a',frequency=224073),Word('zb'),Word('as')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    """    
    return takehighest(chunks, lambda x:x.degreeOfMorphemicFreedom())
Exemplo n.º 3
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('ab'),Word('b',frequency=3200626),Word('ab')])
    >>> chunks = [ first, Chunk([Word('a',frequency=224073),Word('zb'),Word('as')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    """
    return takehighest(chunks, lambda x: x.degreeOfMorphemicFreedom())
Exemplo n.º 4
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('ab'),Word('ab'),Word('ab')])
    >>> chunks = [ first, Chunk([Word('abc'),Word('b'),Word('as')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    """    
    return takehighest(chunks, lambda x:x.variance(), reverse=False)
Exemplo n.º 5
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('abc'),Word('a'),Word('aa')])
    >>> chunks = [first , Chunk([Word('abc'),Word('aa'),Word('a')])]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    """    
    return takehighest(chunks, lambda x:x.reverseLen())
Exemplo n.º 6
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('abc')])
    >>> chunks = [first , Chunk([Word('ab')]), Chunk([Word('a')]), Chunk([Word('a')]), Chunk([Word('a')])]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    >>> chunks = [ Chunk([Word('aa'),Word('bb'),Word('cc')]), Chunk([Word('a'),Word('b'),Word('c'),Word('d'),Word('f'),Word('e')]), Chunk([Word('aa'),Word('bb'),Word('c')]), Chunk([Word('a'),Word('b'),Word('c')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    2
    """
    return takehighest(chunks, len)
Exemplo n.º 7
0
def filter(chunks):
    """
    >>> from word import Word
    >>> from chunk import Chunk
    >>> first = Chunk([Word('abc')])
    >>> chunks = [first , Chunk([Word('ab')]), Chunk([Word('a')]), Chunk([Word('a')]), Chunk([Word('a')])]
    >>> r = filter(chunks)
    >>> len(r)
    1
    >>> r[0] == first
    True
    >>> chunks = [ Chunk([Word('aa'),Word('bb'),Word('cc')]), Chunk([Word('a'),Word('b'),Word('c'),Word('d'),Word('f'),Word('e')]), Chunk([Word('aa'),Word('bb'),Word('c')]), Chunk([Word('a'),Word('b'),Word('c')]) ]
    >>> r = filter(chunks)
    >>> len(r)
    2
    """    
    return takehighest(chunks, len)