本文整理汇总了Python中corpus.Corpus.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Corpus.parse方法的具体用法?Python Corpus.parse怎么用?Python Corpus.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corpus.Corpus
的用法示例。
在下文中一共展示了Corpus.parse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parse
# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import parse [as 别名]
def test_parse():
import shutil
print('Testing parser')
unparsed = Corpus(unparsed_path)
try:
shutil.rmtree('data/test-parsed')
except:
pass
parsed = unparsed.parse()
assert_equals(list([i.name for i in parsed.files]), ['intro.txt.xml', 'body.txt.xml'])
示例2: test_parse_speakseg
# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import parse [as 别名]
def test_parse_speakseg(skipassert = False):
print('Testing parser with speaker segmentation')
unparsed = Corpus(unparsed_path)
import shutil
try:
shutil.rmtree(parsed_path)
except:
pass
parsed = unparsed.parse(speaker_segmentation = True)
if not skipassert:
assert_equals(list([i.name for i in parsed.files]), ['intro.txt.xml', 'body.txt.xml'])
示例3: test_parse_speakseg
# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import parse [as 别名]
def test_parse_speakseg(skipassert = False):
print('Testing parser with speaker segmentation')
unparsed = Corpus(unparsed_path)
import shutil
try:
shutil.rmtree(parsed_path)
except:
pass
parsed = unparsed.parse(speaker_segmentation = True)
fnames = []
for subc in parsed.subcorpora:
for f in subc.files:
fnames.append(f.name)
assert_equals(fnames, ['intro.txt.xml', 'body.txt.xml'])
示例4: test_parse
# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import parse [as 别名]
def test_parse():
import shutil
print('Testing parser')
unparsed = Corpus(unparsed_path)
try:
shutil.rmtree('data/test-parsed')
except:
pass
parsed = unparsed.parse()
fnames = []
for subc in parsed.subcorpora:
for f in subc.files:
fnames.append(f.name)
assert_equals(fnames, ['intro.txt.xml', 'body.txt.xml'])