Bug #3296
Import, CoNLL-U corpus, '--' sentence comment word breaks XML comments
Statut: | New | Début: | 06/10/2022 | ||
---|---|---|---|---|---|
Priorité: | Normal | Echéance: | |||
Assigné à: | - | % réalisé: | 80% |
||
Catégorie: | Import | Temps passé: | - | ||
Version cible: | TXM Syntax 2.0 |
Description
Currently "--" input words/tokens break XML comments encoding.
They should not appear in an XML comment — https://www.w3.org/TR/xml/#sec-comments :
For compatibility, the string " -- " (double-hyphen) MUST NOT occur within comments.] Parameter entity references MUST NOT be recognized within comments.
Discussion¶
FR:
Il s'agit d'une rétro-compatibilité avec SGML si je comprends bien. Donc on peut supposer que l'API javax.xml.stream.XMLStreamWriter ne fait aucun effort pour gérer le cas. Si on cherche à remplacer "--" par des caractères Unicode équivalents ça dépend des cas : https://en.wikipedia.org/wiki/Dash#Types_of_dash. Voici les 5 cas du corpus .conllu posant problème (il s'agit de lignes commentaires UD qui indiquent une traduction des phrases, il ne s'agit pas des phrases analysées syntaxiquement - qui sont en français dans ce corpus) : 1) # text_en = That share has been rising steadily over the years — only 11 percent of the total vote was cast before Election Day in 1996, according to the Census Bureau -- and seems likely to jump again this year. Ici c'est 'facile' : le '--' clos le '—' situé avant (l'encodage n'est pas homogène). On peut supposer que '--' doit être '—' pour encoder le parenthésage. Parenthesis-like use https://en.wikipedia.org/wiki/Dash#Parenthesis-like_use D'après wikipedia ça devrait être typographiquement un "(unspaced) em dash", mais là encore le manque de précision sur les espaces fait qu'on peut supposer que les em dash sont décollés. --> ― 2) # text_en = A Harley-Davidson spokeswoman said timelines that have been floated in the media -- 2017 or 2020 -- aren't accurate. Ici c'est 'facile' : parenthésage également "(unspaced) em dash" '— ... —' ou spaced en dash ' – ... – ' au choix --> ― 3) # text_en = As the movie makes clear, the Lovings -- and Richard in particular -- were reluctant participants in history. Ici c'est 'facile' : parenthésage également "(unspaced) em dash" '— ... —'. --> ― 4) # text_en = "I have to congratulate Andy -- to get to No. 1 in the world that's an incredible achievement," the American said. Quotation mark–like use https://en.wikipedia.org/wiki/Dash#Quotation_mark%E2%80%93like_use --> ― 5) # text_en = It's also fuelled the emergence of modern high-rises -- like the visionary MahaNakhon, Bangkok's tallest building. Là je passe mon tour --> ―
Solution 1¶
Replace all "-" with its UTF-8 entity − -> no information is lost
Solution 2¶
Replace all '--' by '―'. -> information lost
Demandes liées
Révisions associées
refs #3296
Historique
#1 Mis à jour par Matthieu Decorde il y a presque 3 ans
- % réalisé changé de 0 à 80
#2 Mis à jour par Serge Heiden il y a presque 3 ans
- % réalisé changé de 80 à 50
New XML comment breaking case: when the last word of a sentence form ends with '-'.
Example:
<!--# text = Aus solcher Art von §x---> <w ud-head="0" ud-deprel="―" ud-form="Aus" ud-xpos="APPR" ud-dep-upos="|NOUN|" ud-lemma="Aus" ud-upos="ADP" ud-deps="_" ud-id="1" ud-dep-deprel="|NK|" ud-feats="|_|" ud-misc="_">Aus</w> <w ud-deprel="NK" ud-xpos="PIAT" ud-dep-upos="|" ud-lemma="solch" ud-upos="PRON" ud-deps="_" ud-feats="|Case=Dat|Gender=Fem|Number=Sing|PronType=Ind|" ud-head="3" ud-head-deprel="NK" ud-form="solcher" ud-head-upos="NOUN" ud-id="2" ud-dep-deprel="|" ud-misc="_">solcher</w> <w ud-deprel="NK" ud-xpos="NN" ud-dep-upos="|PRON|ADP|" ud-lemma="Art" ud-upos="NOUN" ud-deps="_" ud-feats="|Case=Dat|Gender=Fem|Number=Sing|" ud-head="1" ud-head-deprel="―" ud-form="Art" ud-head-upos="ADP" ud-id="3" ud-dep-deprel="|NK|PG|" ud-misc="_">Art</w> <w ud-deprel="PG" ud-xpos="APPR" ud-dep-upos="|NOUN|" ud-lemma="von" ud-upos="ADP" ud-deps="_" ud-feats="|_|" ud-head="3" ud-head-deprel="NK" ud-form="von" ud-head-upos="NOUN" ud-id="4" ud-dep-deprel="|NK|" ud-misc="_">von</w> <w ud-deprel="NK" ud-xpos="NN" ud-dep-upos="|PROPN|" ud-lemma="§" ud-upos="NOUN" ud-deps="_" ud-feats="|Case=Dat|Gender=Masc|Number=Sing|" ud-head="4" ud-head-deprel="PG" ud-form="§" ud-head-upos="ADP" ud-id="5" ud-dep-deprel="|NK|" ud-misc="SpaceAfter=No">§</w> <w ud-deprel="NK" ud-xpos="NE" ud-dep-upos="|" ud-lemma="x-" ud-upos="PROPN" ud-deps="_" ud-feats="|Case=Nom|Number=Sing|" ud-head="5" ud-head-deprel="NK" ud-form="x-" ud-head-upos="NOUN" ud-id="6" ud-dep-deprel="|" ud-misc="_">x-</w>
Produces error:
** /home/sheiden/TXM-0.8.2/corpora/REICHSTAG/src/12._Sitzung_05.04.1871.xmi.gz.xml [line 3460, character 38]: La chaîne "--" n'est pas autorisée dans les commentaires.
Solution¶
Remplace all '-' by numeric entity:
−
in XML comments.
Remark: Solution resolving also case 1.
#3 Mis à jour par Matthieu Decorde il y a presque 3 ans
- Description mis à jour (diff)
the Solution 1 is better
#4 Mis à jour par Matthieu Decorde il y a presque 3 ans
- % réalisé changé de 50 à 80