# Path: epitator/annotator.py
# class Annotator(object):
#     def annotate(self, doc):
# 
# Path: epitator/spacy_nlp.py
# def custom_sentencizer(doc_text):


from .annotator import Annotator, AnnoSpan, AnnoTier
from .spacy_nlp import spacy_nlp, custom_sentencizer
import re
                    ne_chunk_end = None
                    ne_chunk_type = None
                if token.ent_type_:
                    if token.ent_iob_ == "B":
                        ne_chunk_start = start
                        ne_chunk_end = end
                        ne_chunk_type = token.ent_type_
                    elif token.ent_iob_ == "I":
                        ne_chunk_end = end
                    elif token.ent_iob_ == "O":
                        ne_spans.append(AnnoSpan(start, end,
                                                 doc, label=token.ent_type_))
                    else:
                        raise Exception("Unexpected IOB tag: " + str(token.ent_iob_))
            if ne_chunk_start is not None:
                ne_spans.append(AnnoSpan(ne_chunk_start, ne_chunk_end,
                                         doc, label=ne_chunk_type))

        ambiguous_year_pattern = re.compile(r'\d{1,4}$', re.I)
        for ne_span in ne_spans:
            if ne_span.label == 'DATE' and ambiguous_year_pattern.match(ne_span.text):
                # Sometimes counts like 1500 are parsed as as the year component
                # of dates. This tries to catch that mistake when the year
                # is long enough ago that it is unlikely to be a date.
                date_as_number = int(ne_span.text)
                if date_as_number < 1900:
                    ne_span.label = 'QUANTITY'

        tiers['spacy.noun_chunks'] = AnnoTier(noun_chunks, presorted=True)
        tiers['spacy.tokens'] = AnnoTier(token_spans, presorted=True)

# Path: epitator/annotator.py
# class Annotator(object):
#     def annotate(self, doc):
# 
# Path: epitator/spacy_nlp.py
# def custom_sentencizer(doc_text):


# Path: epitator/spacy_annotator.py
from .annotator import Annotator, AnnoSpan, AnnoTier
from .spacy_nlp import spacy_nlp, custom_sentencizer
import re

                    ne_chunk_end = None
                    ne_chunk_type = None
                if token.ent_type_:
                    if token.ent_iob_ == "B":
                        ne_chunk_start = start
                        ne_chunk_end = end
                        ne_chunk_type = token.ent_type_
                    elif token.ent_iob_ == "I":
                        ne_chunk_end = end
                    elif token.ent_iob_ == "O":
                        ne_spans.append(AnnoSpan(start, end,
                                                 doc, label=token.ent_type_))
                    else:
                        raise Exception("Unexpected IOB tag: " + str(token.ent_iob_))
            if ne_chunk_start is not None:
                ne_spans.append(AnnoSpan(ne_chunk_start, ne_chunk_end,
                                         doc, label=ne_chunk_type))

        ambiguous_year_pattern = re.compile(r'\d{1,4}$', re.I)
        for ne_span in ne_spans:
            if ne_span.label == 'DATE' and ambiguous_year_pattern.match(ne_span.text):
                # Sometimes counts like 1500 are parsed as as the year component
                # of dates. This tries to catch that mistake when the year
                # is long enough ago that it is unlikely to be a date.
                date_as_number = int(ne_span.text)
                if date_as_number < 1900:
                    ne_span.label = 'QUANTITY'

        tiers['spacy.noun_chunks'] = AnnoTier(noun_chunks, presorted=True)
        tiers['spacy.tokens'] = AnnoTier(token_spans, presorted=True)

        tiers['spacy.nes'] = AnnoTier(ne_spans, presorted=True)