当前位置: 首页>>代码示例>>Python>>正文


Python XMLCorpusView.__init__方法代码示例

本文整理汇总了Python中nltk.corpus.reader.xmldocs.XMLCorpusView.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python XMLCorpusView.__init__方法的具体用法?Python XMLCorpusView.__init__怎么用?Python XMLCorpusView.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nltk.corpus.reader.xmldocs.XMLCorpusView的用法示例。


在下文中一共展示了XMLCorpusView.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusView [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusView import __init__ [as 别名]
    def __init__(self, fileid, sent, tag, strip_space, stem):
        """
        :param fileid: The name of the underlying file.
        :param 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.
        """
        if sent:
            tagspec = '.*/s'
        else:
            tagspec = '.*/s/(.*/)?(c|w)'
        self._sent = sent
        self._tag = tag
        self._strip_space = strip_space
        self._stem = stem

        self.title = None  #: Title of the document.
        self.author = None  #: Author of the document.
        self.editor = None  #: Editor
        self.resps = None  #: Statement of responsibility

        XMLCorpusView.__init__(self, fileid, tagspec)

        # Read in a tasty header.
        self._open()
        self.read_block(self._stream, '.*/teiHeader$', self.handle_header)
        self.close()

        # Reset tag context.
        self._tag_context = {0: ()}
开发者ID:Journo-App,项目名称:flask-by-example,代码行数:33,代码来源:bnc.py

示例2: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusView [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusView import __init__ [as 别名]
 def __init__(self, filename, **kwargs):
     self.tags = kwargs.pop('tags', None)
     self.tagspec = '.*/seg/fs'
     self.xml_tool = XML_Tool(filename, 'ann_morphosyntax.xml')
     XMLCorpusView.__init__(
         self, self.xml_tool.build_preprocessed_file(), self.tagspec
     )
开发者ID:prz3m,项目名称:kind2anki,代码行数:9,代码来源:nkjp.py

示例3: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusView [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusView import __init__ [as 别名]
 def __init__(self, filename, **kwargs):
     self.mode = kwargs.pop('mode', 0)
     self.tagspec = '.*/div/ab'
     self.segm_dict = dict()
     #xml preprocessing
     self.xml_tool = XML_Tool(filename, 'text.xml')
     #base class init
     XMLCorpusView.__init__(self, self.xml_tool.build_preprocessed_file(), self.tagspec)
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:10,代码来源:nkjp.py

示例4: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusView [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusView import __init__ [as 别名]
    def __init__(self, fileid, unit, bracket_sent, pos_tag, sem_tag):
        """
        :param fileid: The name of the underlying file.
        :param unit: One of `'token'`, `'word'`, or `'chunk'`.
        :param bracket_sent: If true, include sentence bracketing.
        :param pos_tag: Whether to include part-of-speech tags.
        :param sem_tag: Whether to include semantic tags, namely WordNet lemma
            and OOV named entity status.
        """
        if bracket_sent: tagspec = '.*/s'
        else: tagspec = '.*/s/(punc|wf)'

        self._unit = unit
        self._sent = bracket_sent
        self._pos_tag = pos_tag
        self._sem_tag = sem_tag

        XMLCorpusView.__init__(self, fileid, tagspec)
开发者ID:brymaven,项目名称:nltk,代码行数:20,代码来源:semcor.py

示例5: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusView [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusView import __init__ [as 别名]
 def __init__(self, fileid, tagspec, elt_handler=None):
     XMLCorpusView.__init__(self, fileid, tagspec, elt_handler)
开发者ID:Copper-Head,项目名称:nltk,代码行数:4,代码来源:mte.py


注:本文中的nltk.corpus.reader.xmldocs.XMLCorpusView.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。