# automatically generated by the FlatBuffers compiler, do not modify

# namespace: spacy

import flatbuffers

class SpacyResponse(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsSpacyResponse(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = SpacyResponse()
        x.Init(buf, n + offset)
        return x

    # SpacyResponse
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # SpacyResponse
    def Dep(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .DEPSpacyResponse import DEPSpacyResponse
            obj = DEPSpacyResponse()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SpacyResponse
    def DepLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SpacyResponse
    def Ner(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .NERSpacyResponse import NERSpacyResponse
            obj = NERSpacyResponse()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SpacyResponse
    def NerLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def SpacyResponseStart(builder): builder.StartObject(2)
def SpacyResponseAddDep(builder, dep): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(dep), 0)
def SpacyResponseStartDepVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SpacyResponseAddNer(builder, ner): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(ner), 0)
def SpacyResponseStartNerVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SpacyResponseEnd(builder): return builder.EndObject()
