繁体   English   中英

抓取仅从翻译后的Google专利页面中获取英文文本

[英]Scrape to get only english text from translated google patent page

    <section itemprop="claims" itemscope>
   <h2>Claims (<span itemprop="count">20</span>)</h2>
   <aside>Translated from <span itemprop="translatedLanguage">German</span></aside>
   <div itemprop="content" html><div mxw-id="PCLM47023824" lang="DE" load-source="patent-office" class="claims"><div class="claim"><div num="1" class="claim"><div class="claim-text"> <span class="notranslate" onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">1. Einrichtung zum Installieren von Versorgungsleitungen und/oder Datenleitungen für mehrere Arbeitsplätze, insbesonde re miteinander und/oder mit einer zentralen Einrichtung ver bundenen Computer-Arbeitsplätze oder dergleichen in einem Räum, <b>dadurch gekennzeichnet</b> , dass ein aus vorbereiteten Ele menten gerüstartig aufbaubares System vorgesehen ist, das un terhalb einer Decke ( <b>12</b> ) des Raumes und oberhalb einer norma len Greifhöhe anbringbare Kanäle ( <b>18</b> , <b>18</b> &#39;) zur Aufnahme von Versorgungsleitungen und/oder Datenleitungen enthält, wobei an die Kanäle ( <b>18</b> , <b>18</b> &#39;) nach unten gerichtete, Arbeitsplätzen zu geordnete Säulen ( <b>21</b> , <b>27</b> ) anschließbar sind, die mit in Greif höhe anzuordnenden Versorgungsanschlüssen ( <b>23</b> ) versehen sind.</span> 1. means for installing supply lines and / or data lines for several jobs, insbesonde re each other and / or with a central facility ver affiliated computer workstations or the like in a cavities, <b>characterized in</b> that a Ele from prepared elements is like a framework to-assemble system provided which &#39;contains for receiving supply lines and / or data lines, wherein the channels <b>(18,</b> <b>18</b> un terhalb a ceiling <b>(12)</b> of the room and above a norma len picking height attachable channels <b>(18,</b> <b>18)&#39;)</b> downward, jobs to subordinate columns <b>(21,</b> <b>27)</b> are connected, which are provided with height in Griffin to be arranged supply terminals <b>(23).</b></span> </div></div></div><div class="claim-dependent"><div num="2" class="claim"> <div class="claim-text"> <span class="notranslate" onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">2. Einrichtung nach Anspruch 1, dadurch gekennzeichnet, dass für die Kanäle ( <b>18</b> ) Hängehalter ( <b>19</b> ) zum Aufhängen an der De cke ( <b>12</b> ) des Raumes vorgesehen sind.</span> 2. Device according to claim 1, characterized in that the channels <b>(18)</b> hanging holder <b>(19)</b> for hanging on the De blocks <b>(12)</b> of the space are provided.</span> </div></div></div></div>
 </section>

有关更多参考,我可以检查此页面的源代码

上面的代码只是以上页面中的示例。 我尝试了BeautifulSoup(page).findAll('Section')[5].getText() ,但是它同时给出了德语和英语文本。

谁能告诉我一种通过使用BeautifulSoup之类的函数或使用正则表达式来仅提取英语单词的方法吗?

BeautifulSoup(page).findAll('Section')[5]仅获取第六section标签的内容。 您需要进一步解析。 尝试做类似的事情:

soup = BeautifulSoup(page, 'html.parser')
section = soup.findAll('section')[5]
content = section.find('span', {'class':'notranslate'}) #finds the span with text
eng_text = content.contents[1:] #strips-off German text

print(eng_text[0].strip())

输出:

1. means for installing supply lines and / or data lines for several jobs, insbesonde re each other and / or with a central facility ver affiliated computer workstations or the like in a cavities,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM