# Path: epitator/annotator.py
# class Annotator(object):
#     def annotate(self, doc):
# 
# Path: epitator/pos_annotator.py
# class POSAnnotator(Annotator):
# 
#     def annotate(self, doc):
#         if 'spacy.tokens' not in doc.tiers:
#             doc.add_tiers(SpacyAnnotator())
#         pos_spans = [AnnoSpan(span.start, span.end, doc, label=span.token.tag_)
#                      for span in doc.tiers['spacy.tokens'].spans]
#         doc.tiers['pos'] = AnnoTier(pos_spans)
#         return doc


import unittest
from epitator.annotator import AnnoDoc
from epitator.pos_annotator import POSAnnotator
from __future__ import absolute_import



class POSAnnotatorTest(unittest.TestCase):

    def setUp(self):
        self.annotator = POSAnnotator()

    def test_simple_sentence(self):

        self.doc = AnnoDoc("Hi Joe.")
        self.annotator.annotate(self.doc)

        self.assertEqual(len(self.doc.tiers['pos'].spans), 3)

        self.assertEqual(self.doc.tiers['pos'].spans[0].label, 'UH')
        self.assertEqual(self.doc.tiers['pos'].spans[0].start, 0)
        self.assertEqual(self.doc.tiers['pos'].spans[0].end, 2)

        self.assertEqual(self.doc.tiers['pos'].spans[1].label, 'NNP')
        self.assertEqual(self.doc.tiers['pos'].spans[1].start, 3)
        self.assertEqual(self.doc.tiers['pos'].spans[1].end, 6)

        self.assertEqual(self.doc.tiers['pos'].spans[2].label, '.')
        self.assertEqual(self.doc.tiers['pos'].spans[2].start, 6)
        self.assertEqual(self.doc.tiers['pos'].spans[2].end, 7)

    def test_initial_space(self):


# Path: epitator/annotator.py
# class Annotator(object):
#     def annotate(self, doc):
# 
# Path: epitator/pos_annotator.py
# class POSAnnotator(Annotator):
# 
#     def annotate(self, doc):
#         if 'spacy.tokens' not in doc.tiers:
#             doc.add_tiers(SpacyAnnotator())
#         pos_spans = [AnnoSpan(span.start, span.end, doc, label=span.token.tag_)
#                      for span in doc.tiers['spacy.tokens'].spans]
#         doc.tiers['pos'] = AnnoTier(pos_spans)
#         return doc


# Path: tests/annotator/test_pos_annotator.py
import unittest
from epitator.annotator import AnnoDoc
from epitator.pos_annotator import POSAnnotator

from __future__ import absolute_import



class POSAnnotatorTest(unittest.TestCase):

    def setUp(self):
        self.annotator = POSAnnotator()

    def test_simple_sentence(self):

        self.doc = AnnoDoc("Hi Joe.")
        self.annotator.annotate(self.doc)

        self.assertEqual(len(self.doc.tiers['pos'].spans), 3)

        self.assertEqual(self.doc.tiers['pos'].spans[0].label, 'UH')
        self.assertEqual(self.doc.tiers['pos'].spans[0].start, 0)
        self.assertEqual(self.doc.tiers['pos'].spans[0].end, 2)

        self.assertEqual(self.doc.tiers['pos'].spans[1].label, 'NNP')
        self.assertEqual(self.doc.tiers['pos'].spans[1].start, 3)
        self.assertEqual(self.doc.tiers['pos'].spans[1].end, 6)

        self.assertEqual(self.doc.tiers['pos'].spans[2].label, '.')
        self.assertEqual(self.doc.tiers['pos'].spans[2].start, 6)
        self.assertEqual(self.doc.tiers['pos'].spans[2].end, 7)

    def test_initial_space(self):


        self.doc = AnnoDoc(" Hi.")