def __init__(self, ref,  resolver=None, doc=None, remove_special=True):
self.resolver = resolver or doc.resolver<EOL>assert self.resolver is not None<EOL>self._remove_special = remove_special<EOL>if isinstance(ref, (Url, Source)):<EOL><INDENT>self._ref = ref<EOL><DEDENT>else:<EOL><INDENT>self._ref = parse_app_url(ref)<EOL><DEDENT>assert isinstance(self._ref, (Url, Source)), (type(ref), ref)<EOL>self._path = '<STR_LIT>' <EOL>self._doc = doc<EOL>self._param_map = []  <EOL>self._declared_sections = {}  <EOL>self._declared_terms = {}  <EOL>self.errors = set()<EOL>if self.doc:<EOL><INDENT>self.root = self.doc.root<EOL><DEDENT>else:<EOL><INDENT>self.root = RootSectionTerm(file_name=self.path, doc=self.doc)<EOL><DEDENT>self.install_declare_terms()<EOL>
:param term_gen: an an iterator that generates terms
:param remove_special: If true ( default ) remove the special terms from the stream
:return: