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


Python XMLCorpusReader.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
 def __init__(self, root, fileids='.*'):
     """
     Corpus reader designed to work with National Corpus of Polish.
     See http://nkjp.pl/ for more details about NKJP.
     use example:
     import nltk
     import nkjp
     from nkjp import NKJPCorpusReader
     x = NKJPCorpusReader(root='/home/USER/nltk_data/corpora/nkjp/', fileids='') # obtain the whole corpus
     x.header()
     x.raw()
     x.words()
     x.tagged_words(tags=['subst', 'comp'])  #Link to find more tags: nkjp.pl/poliqarp/help/ense2.html
     x.sents()
     x = NKJPCorpusReader(root='/home/USER/nltk_data/corpora/nkjp/', fileids='Wilk*') # obtain particular file(s)
     x.header(fileids=['WilkDom', '/home/USER/nltk_data/corpora/nkjp/WilkWilczy'])
     x.tagged_words(fileids=['WilkDom', '/home/USER/nltk_data/corpora/nkjp/WilkWilczy'], tags=['subst', 'comp'])
     """
     if isinstance(fileids, string_types):
         XMLCorpusReader.__init__(self, root, fileids + '.*/header.xml')
     else:
         XMLCorpusReader.__init__(
             self, root, [fileid + '/header.xml' for fileid in fileids]
         )
     self._paths = self.get_paths()
开发者ID:prz3m,项目名称:kind2anki,代码行数:27,代码来源:nkjp.py

示例2: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
	def __init__(self, *args, **kwargs):
		if 'textid_file' in kwargs: self._textids = kwargs['textid_file']
		else: self._textids = None

		XMLCorpusReader.__init__(self, *args)
		CategorizedCorpusReader.__init__(self, kwargs)

		self._init_textids()
开发者ID:52nlp,项目名称:Text-Summarization,代码行数:10,代码来源:pl196x.py

示例3: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
    def __init__(self, root, fileids, wrap_etree=False):
        XMLCorpusReader.__init__(self, root, fileids, wrap_etree)

        self._lemma_to_class = defaultdict(list)
        """A dictionary mapping from verb lemma strings to lists of
        verbnet class identifiers."""

        self._wordnet_to_class = defaultdict(list)
        """A dictionary mapping from wordnet identifier strings to
        lists of verbnet class identifiers."""

        self._class_to_fileid = {}
        """A dictionary mapping from class identifiers to
        corresponding file identifiers.  The keys of this dictionary
        provide a complete list of all classes and subclasses."""

        self._shortid_to_longid = {}

        # Initialize the dictionaries.  Use the quick (regexp-based)
        # method instead of the slow (xml-based) method, because it
        # runs 2-30 times faster.
        self._quick_index()
开发者ID:DrDub,项目名称:nltk,代码行数:24,代码来源:verbnet.py

示例4: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
 def __init__(self, root, fileids, lazy=True):
     XMLCorpusReader.__init__(self, root, fileids)
     self._lazy = lazy
开发者ID:langcog,项目名称:alignment,代码行数:5,代码来源:mychildes.py

示例5: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
 def __init__(self, root, fileids, wordnet, lazy=True):
     XMLCorpusReader.__init__(self, root, fileids)
     self._lazy = lazy
     self._wordnet = wordnet
开发者ID:prz3m,项目名称:kind2anki,代码行数:6,代码来源:semcor.py

示例6: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
	def __init__(self, root, fileids):
		XMLCorpusReader.__init__(self, root, fileids)		
开发者ID:pln-fing-udelar,项目名称:weasel-detect,代码行数:4,代码来源:WeaselCorpusReader.py

示例7: __init__

# 需要导入模块: from nltk.corpus.reader.xmldocs import XMLCorpusReader [as 别名]
# 或者: from nltk.corpus.reader.xmldocs.XMLCorpusReader import __init__ [as 别名]
 def __init__(self, root, fileid):
     XMLCorpusReader.__init__(self, root, fileid)
     self._fileid = self._fileids[0]
     self.elt = self.xml()
     self.data = _xml_to_dict(self.elt)   
开发者ID:geoffbacon,项目名称:qp,代码行数:7,代码来源:flex.py


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