'Helper used to implement the view methods -- returns a list of
words or a list of sentences, optionally tagged.
:param fileid: The name of the underlying file.
:param bracket_sent: If true, include sentence bracketing.
:param tag: The name of the tagset to use, or None for no tags.
:param strip_space: If true, strip spaces from word tokens.
:param stem: If true, then substitute stems for words.'

def _words(self, fileid, bracket_sent, tag, strip_space, stem):

    result = []
    xmldoc = ElementTree.parse(fileid).getroot()
    for xmlsent in xmldoc.findall('.//s'):
        sent = []
        for xmlword in _all_xmlwords_in(xmlsent):
            word = xmlword.text
            if (not word):
                word = ''
            if (strip_space or stem):
                word = word.strip()
            if stem:
                word = xmlword.get('hw', word)
            if (tag == 'c5'):
                word = (word, xmlword.get('c5'))
            elif (tag == 'pos'):
                word = (word, xmlword.get('pos', xmlword.get('c5')))
            sent.append(word)
        if bracket_sent:
            result.append(BNCSentence(xmlsent.attrib['n'], sent))
        else:
            result.extend(sent)
    assert (None not in result)
    return result
