benchmarks/ud_benchmark/scripts/evaluate.py
def gold_to_texts(gold_conllu: str) -> List[str]:
    """Create raw texts from CoNLL-U file. Uses "# newdoc"/"# newpar"
    divisions, "# text" lines, and "SpaceAfter=No" to build a list of raw
    texts."""
    texts = []
    with open(gold_conllu) as fileh:
        text = ""
        prev_line = ""
        for line in fileh:
            line = line.strip()
            if text and (line.startswith("# newdoc") or line.startswith("# newpar")):
                texts.append(re.sub("\s+", " ", text.strip()))
                text = ""
            if line.startswith("# text = "):
                text += line.replace("# text = ", "")
            if line == "":
                cols = prev_line.split("\t")
                if len(cols) >= 10:
                    if not "SpaceAfter=No" in cols[9]:
                        text += " "
            prev_line = line
        if text:
            texts.append(text)
    return texts
Create raw texts from CoNLL-U file. Uses "# newdoc"/"# newpar"
    divisions, "# text" lines, and "SpaceAfter=No" to build a list of raw
    texts.
Create raw texts from CoNLL-U file.
Create raw texts from CoNLL - U file .
def gold_to_texts(gold_conllu: str) -> List[str]:
    texts = []
    with open(gold_conllu) as fileh:
        text = ""
        prev_line = ""
        for line in fileh:
            line = line.strip()
            if text and (line.startswith("# newdoc") or line.startswith("# newpar")):
                texts.append(re.sub("\s+", " ", text.strip()))
                text = ""
            if line.startswith("# text = "):
                text += line.replace("# text = ", "")
            if line == "":
                cols = prev_line.split("\t")
                if len(cols) >= 10:
                    if not "SpaceAfter=No" in cols[9]:
                        text += " "
            prev_line = line
        if text:
            texts.append(text)
    return texts
def gold_to_texts ( gold_conllu : str ) -> List [ str ] : texts = [ ] with open ( gold_conllu ) as fileh : text = "" prev_line = "" for line in fileh : line = line . strip ( ) if text and ( line . startswith ( "# newdoc" ) or line . startswith ( "# newpar" ) ) : texts . append ( re . sub ( "\s+" , " " , text . strip ( ) ) ) text = "" if line . startswith ( "# text = " ) : text += line . replace ( "# text = " , "" ) if line == "" : cols = prev_line . split ( "\t" ) if len ( cols ) >= 10 : if not "SpaceAfter=No" in cols [ 9 ] : text += " " prev_line = line if text : texts . append ( text ) return texts
Create raw texts from CoNLL-U file.
Create raw texts from CoNLL - U file .
"""Create raw texts from CoNLL-U file. Uses "# newdoc"/"# newpar"
    divisions, "# text" lines, and "SpaceAfter=No" to build a list of raw
    texts."""
gold_conllu
str