2

使用输入文件apertest.html

<h4><a href="/" rel="nofollow" title="Vodafone anuncia su plan para actualizar la red de cable de Ono a la tecnología DOCSIS 3.1 para poder ofrecer conexiones simétricas de 1 Gbps"><span class="title">Vodafone actualizará la red de Ono para poder ofrecer 1 Gbps simétrico</span> <span class="reach">144</span> <span class="date">2016</span> </a></h4>

运行 cat apertest.html | apertium -f html -u es-en,输出:

<h4><a href="/" rel="nofollow" title="Vodafone Announces his plan to update the network of wire of Ono to the technology DOCSIS 3.1 to be able to offer symmetrical connections of 1 Gbps"><span class="title">Vodafone Will</span> update <span class="title">the network of Ono to be able to offer 1 Gbps symmetrical</span> <span class="reach">144</span> <span class="date">2016</span></a></h4>

我期待:

<h4><a href="/" rel="nofollow" title="Vodafone Announces his plan to update the network of wire of Ono to the technology DOCSIS 3.1 to be able to offer symmetrical connections of 1 Gbps"><span class="title">Vodafone Will update the network of Ono to be able to offer 1 Gbps symmetrical</span> <span class="reach">144</span> <span class="date">2016</span></a></h4>

为什么要把句子分成三部分?

4

1 回答 1

1

相当肯定这是因为跨度被认为是单词绑定标签(如<em>or <b>)而不是块级别(如<div>)。如果标签是字绑定的,Apertium 可以自由删除或复制它。块级结构 OTOH 始终被保留。

如果使用某些类的 span 就好像它们是块级标签一样,您可以预处理(将全部<span class="title">转换为 div),或者您可以使用https://github.com/TinoDidriksen/Transfuse/(底层格式处理库)查看如果可以对跨度进行更细致的处理(如果这种事情经常发生,Transfuse 中有一个新功能可以让您将某些跨度标记为实际上是 div,这可能是有意义的)。不过,预处理似乎是最简单的方法。

于 2021-09-07T07:02:38.020 回答