# Path: tde/util/printing.py
# @contextmanager
# def verb_print(label, verbose=False, when_done=False,
#                timeit=False, with_dots=False):
#     if timeit:
#         t0 = time.time()
#     if verbose:
#         msg = label + ('...' if with_dots else '') + ('' if when_done else '\n')
#         print msg,
#         sys.stdout.flush()
#     try:
#         yield
#     finally:
#         if verbose and when_done:
#             if timeit:
#                 print 'done. Time: {0:.3f}s'.format(time.time() - t0)
#             else:
#                 print 'done.'
#             sys.stdout.flush()
#         elif verbose and timeit:
#             print '{1}: time: {0:.3f}s'.format(time.time() - t0, label)
#             sys.stdout.flush()
# 
# Path: tde/util/functions.py
# def unique(iterable):
#     seen = set()
#     seen_add = seen.add
#     for element in iterable:
#         if element in seen:
#             continue
#         seen_add(element)
#         yield element
# 
# def iterator_length(iterable):
#     return sum(1 for _ in iterable)


import numpy as np
from tde.util.printing import verb_print
from tde.util.functions import unique, iterator_length
"""Evaluate token and type measures"""

from __future__ import division



def evaluate_token_type(disc_clsdict, wrd_corpus,
                        verbose=False, debug=False):
    n_word_tokens = iterator_length(unique(wrd_corpus.iter_fragments()))
    word_types = set(f.mark for f in wrd_corpus.iter_fragments())
    n_word_types = len(word_types)

# Path: tde/util/printing.py
# @contextmanager
# def verb_print(label, verbose=False, when_done=False,
#                timeit=False, with_dots=False):
#     if timeit:
#         t0 = time.time()
#     if verbose:
#         msg = label + ('...' if with_dots else '') + ('' if when_done else '\n')
#         print msg,
#         sys.stdout.flush()
#     try:
#         yield
#     finally:
#         if verbose and when_done:
#             if timeit:
#                 print 'done. Time: {0:.3f}s'.format(time.time() - t0)
#             else:
#                 print 'done.'
#             sys.stdout.flush()
#         elif verbose and timeit:
#             print '{1}: time: {0:.3f}s'.format(time.time() - t0, label)
#             sys.stdout.flush()
# 
# Path: tde/util/functions.py
# def unique(iterable):
#     seen = set()
#     seen_add = seen.add
#     for element in iterable:
#         if element in seen:
#             continue
#         seen_add(element)
#         yield element
# 
# def iterator_length(iterable):
#     return sum(1 for _ in iterable)


# Path: tde/measures/token_type.py
import numpy as np
from tde.util.printing import verb_print
from tde.util.functions import unique, iterator_length

"""Evaluate token and type measures"""

from __future__ import division



def evaluate_token_type(disc_clsdict, wrd_corpus,
                        verbose=False, debug=False):
    n_word_tokens = iterator_length(unique(wrd_corpus.iter_fragments()))
    word_types = set(f.mark for f in wrd_corpus.iter_fragments())
    n_word_types = len(word_types)

    n_disc_fragments = iterator_length(disc_clsdict.iter_fragments())