예제 #1
0
파일: tests.py 프로젝트: chloebt/educe
 def _test_trees(self):
     if not self._trees:
         self._trees = {}
         for i, tstr in enumerate([TSTR0, TSTR1]):
             self._trees["tstr%d" % i] = parse.parse_rst_dt_tree(tstr)
         for i in glob.glob('tests/*.dis'):
             bname = os.path.basename(i)
             tfile = os.path.splitext(i)[0]
             self._trees[bname] = parse.read_annotation_file(i, tfile)
     return self._trees
예제 #2
0
 def _test_trees(self):
     if not self._trees:
         self._trees = {}
         for i, tstr in enumerate([TSTR0, TSTR1]):
             self._trees["tstr%d" % i] = parse.parse_rst_dt_tree(tstr)
         for i in glob.glob('tests/*.dis'):
             bname = os.path.basename(i)
             tfile = os.path.splitext(i)[0]
             self._trees[bname] = parse.read_annotation_file(i, tfile)
     return self._trees
예제 #3
0
파일: __init__.py 프로젝트: arne-cl/educe
 def slurp_subcorpus(self, cfiles, verbose=False):
     """
     See `educe.rst_dt.parse` for a description of `RSTTree`
     """
     corpus={}
     counter=0
     for k in cfiles.keys():
         if verbose:
             sys.stderr.write("\rSlurping corpus dir [%d/%d]" % (counter, len(cfiles)))
         f = cfiles[k]
         annotations=parse.read_annotation_file(f)
         annotations.set_origin(k)
         corpus[k]=annotations
         counter=counter+1
     if verbose:
         sys.stderr.write("\rSlurping corpus dir [%d/%d done]\n" % (counter, len(cfiles)))
     return corpus
예제 #4
0
파일: corpus.py 프로젝트: moreymat/educe
 def slurp_subcorpus(self, cfiles, verbose=False):
     """
     See `educe.rst_dt.parse` for a description of `RSTTree`
     """
     corpus = {}
     counter = 0
     for k in cfiles.keys():
         if verbose:
             sys.stderr.write("\rSlurping corpus dir [%d/%d]" %
                              (counter, len(cfiles)))
         annotations = parse.read_annotation_file(*cfiles[k])
         annotations.set_origin(k)
         corpus[k] = annotations
         counter = counter + 1
     if verbose:
         sys.stderr.write("\rSlurping corpus dir [%d/%d done]\n" %
                          (counter, len(cfiles)))
     return corpus
예제 #5
0
파일: tests.py 프로젝트: chloebt/educe
 def test_from_files(self):
     for i in glob.glob('tests/*.dis'):
         t = read_annotation_file(i, os.path.splitext(i)[0])
         self.assertEqual(len(t.text()), treenode(t).span.char_end)
예제 #6
0
 def test_from_files(self):
     for i in glob.glob('tests/*.dis'):
         t = read_annotation_file(i, os.path.splitext(i)[0])
         self.assertEqual(len(t.text()), treenode(t).span.char_end)