Split a term in to parent and record term components
        :param term: combined term text
        :return: Tuple of parent and record term
18698
def split_term(cls, term):
        

        if '.' in term:
            parent_term, record_term = term.split('.')
            parent_term, record_term = parent_term.strip(), record_term.strip()

            if parent_term == '':
                parent_term = ELIDED_TERM

        else:
            parent_term, record_term = ROOT_TERM, term.strip()

        return parent_term, record_term
758254
public static List<Term> getSubTerm(Term from, Term to) {
		
		List<Term> subTerm = new ArrayList<Term>(3);

		while ((from = from.to()) != to) {
			subTerm.add(from);
		}

		return subTerm;
	}
427527
def get_document_frequency(self, term):
        
        if term not in self._terms:
            raise IndexError(TERM_DOES_NOT_EXIST)
        else:
            return len(self._terms[term])
1037043
def _include_pretrained_vocab(self, pretrained_word_dict, candidates):
        
        terms = Counter()
        for c in candidates:
            for w in c.get_parent().words:
                if w in pretrained_word_dict:
                    terms[w] += 1
        list(map(self.word_dict.get, terms))
1054939
def generate_terms(self, ref, root, file_type=None):
        

        last_section = root
        t = None

        if isinstance(ref, Source):
            row_gen = ref
            ref_path = row_gen.__class__.__name__
        else:
            row_gen = get_generator(ref)
            ref_path = ref.path


        try:
            for line_n, row in enumerate(row_gen, 1):

                if not row or not row[0] or not row[0].strip() or row[0].strip().startswith('#'):
                    continue

                tt = Term(row[0], None) # Just to get the qualified name constructed property

                term_class = self.get_term_class(tt.join_lc)

                t = term_class(tt.join_lc,
                         row[1] if len(row) > 1 else '',
                         row[2:] if len(row) > 2 else [],
                         row=line_n,
                         col=1,
                         file_name=ref_path, file_type=file_type, doc=self.doc)

                # Why did we remove comments from values? It strips out Markdown
                #if t.value and str(t.value).startswith('#'): # Comments are ignored
                #    continue

                if t.term_is('include') or t.term_is('declare'):

                    if t.term_is('include'):
                        resolved = self.find_include_doc(dirname(ref_path), t.value.strip())
                    else:
                        resolved = self.find_declare_doc(dirname(ref_path), t.value.strip())

                    if row_gen.ref == resolved:
                        raise IncludeError("Include loop for '{}' ".format(resolved))

                    yield t

                    try:

                        sub_gen = get_generator(resolved.get_resource().get_target())

                        for t in self.generate_terms(sub_gen, root, file_type=t.record_term_lc):
                            yield t

                        if last_section:
                            yield last_section  # Re-assert the last section

                    except IncludeError as e:
                        e.term = t
                        raise

                    except (OSError,  FileNotFoundError, GenerateError, DownloadError) as e:
                        e = IncludeError("Failed to Include; {}".format(e))
                        e.term = t
                        raise e

                    continue  # Already yielded the include/declare term, and includes can't have children

                elif t.term_is('section'):

                    # If there is already a section in the document, emit the existing section,
                    # rather than a new one.
                    try:
                        last_section = self.doc[t.name]
                        t = last_section

                    except (KeyError, TypeError): # TypeError -> self.doc is None
                        last_section = t

                yield t

                # Yield any child terms, from the term row arguments
                if not t.term_is('section') and not t.term_is('header'):
                    for col, value in enumerate(t.args, 0):
                        if str(value).strip():

                            term_name = t.record_term_lc + '.' + str(col)

                            term_class = self.get_term_class(term_name)

                            yield term_class(term_name, str(value), [],
                                       row=line_n,
                                       col=col + 2,  # The 0th argument starts in col 2
                                       file_name=ref_path,
                                       file_type=file_type,
                                       parent=t) #,
                                       #doc=None,
                                       #section=last_section)
        except IncludeError as e:
            exc = IncludeError(str(e) + "; in '{}' ".format(ref_path))
            exc.term = e.term if hasattr(e, 'term') else None
            raise exc
375720
def parseSearchTerm(term):
    
    terms = []
    keywords = {}
    for word in term.split():
        if word.count(':') == 1:
            k, v = word.split(u':')
            if k and v:
                keywords[k] = v
            elif k or v:
                terms.append(k or v)
        else:
            terms.append(word)
    term = u' '.join(terms)
    if keywords:
        return term, keywords
    return term, None
92875
def _include_term_list(self, termlist):
        
        ref_needed = False
        for term in termlist:
            ref_needed = ref_needed or self._include_term(term)
        return ref_needed
99182
def find(self, term, value=False):
        
        if '.' in term:
            parent, term = term.split('.')
            assert parent.lower() == self.record_term_lc, (parent.lower(), self.record_term_lc)

        for c in self.children:
            if c.record_term_lc == term.lower():
                if value is False or c.value == value:
                    yield c
219492
def _has_terms(self):
        
        loc = self._super_get('_term_location')
        return self._super_has(loc) \
               and isiterable(self._super_get(loc)) \
               and len(self._super_get(loc)) > 0 \
               and all([isinstance(term, Term) for term in self._super_get(loc)])
1168962
def split(self, sep=None, maxsplit=sys.maxsize):
    
    return WordList(self._strkey().split(sep, maxsplit), parent=self)
254696
def parents(self):
        
        return TermList(unique_everseen(
            y for x in self for y in x.parents
        ))
595516
def word_fts(self, word):
        
        return list(map(self.fts, self.segs(word)))
131397
def binary_to_term(data):
    
    if not isinstance(data, bytes):
        raise ParseException('not bytes input')
    size = len(data)
    if size <= 1:
        raise ParseException('null input')
    if b_ord(data[0]) != _TAG_VERSION:
        raise ParseException('invalid version')
    try:
        i, term = _binary_to_term(1, data)
        if i != size:
            raise ParseException('unparsed data')
        return term
    except struct.error:
        raise ParseException('missing data')
    except IndexError:
        raise ParseException('missing data')
980191
def createRecordItem(self, record, parent=None):
        
        if parent is None:
            parent=self
        
        return self.recordItemClass(record)(parent, record)
977659
def _make_query_from_terms(self, terms):
        

        expanded_terms = self._expand_terms(terms)

        cterms = ''
        if expanded_terms['doc']:
            cterms = self.backend._or_join(expanded_terms['doc'])

        keywords = expanded_terms['keywords']

        frm_to = self._from_to_as_term(expanded_terms['from'], expanded_terms['to'])

        if frm_to:
            keywords.append(frm_to)

        if keywords:
            if cterms:
                cterms = self.backend._and_join(
                    [cterms, self.backend._field_term('keywords', expanded_terms['keywords'])])
            else:
                cterms = self.backend._field_term('keywords', expanded_terms['keywords'])

        logger.debug('partition terms conversion: `{}` terms converted to `{}` query.'.format(terms, cterms))

        return cterms
1374941
def set_wrappable_term(self, v, term):
        

        import textwrap

        for t in self['Root'].find(term):
            self.remove_term(t)

        for l in textwrap.wrap(v, 80):
            self['Root'].new_term(term, l)
502836
function getRelativeTerm(term, root) {
  term = term.slice(root.length);
  return _.str.trim(term, path.sep);
}