zoukankan      html  css  js  c++  java
  • 论文翻译第二弹--用python(或Markdown)对论文复制文本进行处理

    图中这种论文你想进行文本复制放入翻译软件进行翻译时,会发现是这种形式:

    句子之间是断开的,这时普遍的方法,也是我之前一直用的方法就是打开一个文档编辑器,复制上去后一行行地继续调整。昨天不想这样了,就打算写个批量处理的函数完成这项工作。
    python小白在重复了一个小时的工作之后,总是有奇怪的问题出现,打算放弃时突然搞好了。之前的函数编写逻辑出现了问题,想在每一行后面加空格然后把第二行的数据增加到第一行上,不熟悉的操作使得字符串数据变成了list数据而不知如何下手。最后删代码时突然发现,只需要把每一行后面的换行符
    删除掉再加空格即可。

    ff = open('b.txt','w')  #打开一个文件,可写模式
    with open('a.txt','r') as f:  #打开一个文件只读模式
        line = f.readlines()
        for line_list in line:
            line_new =line_list.replace('
    ','')
            line_new =line_new+' '  #行末尾加上" "
            ff.write(line_new)
    

    不过该程序也有一个问题,在结果文件中没有换行符的存在,也就是分段不明显。尝试在段首加入 进行分隔,但google在翻译的时候会忽视tab的存在而照样看不出分段的模样。有些遗憾但能基本功能可以使用了。

    Abstract〞Autonomous feeding is challenging because it requires manipulation of food items with various compliance, sizes, and shapes. To understand how humans manipulate food items during feeding and to explore ways to adapt their strategies to robots, we collected a rich dataset of human trajectories by asking them to pick up food and feed it to a mannequin. From the analysis of the collected haptic and motion signals, we demonstrate that humans adapt their control policies to

    P.S.在编辑的时候突然发现一个更简单的方法,把文字复制到markdown编辑器中,比如有道云笔记,可以利用markdown特殊的语法得到相同的结果。

  • 相关阅读:
    VueJS中学习使用Vuex详解
    https://www.cnblogs.com/chinabin1993/p/9848720.html
    5分钟带你入门vuex(vue状态管理)
    引用第三方 chalk 模块
    Vue-Grid-Layout分享一款好用的可拖拽组件
    vue-grid-layout
    拖拽 ‘vue-grid-layout’ 插件了解下
    Vue国际化处理 vue-i18n 以及项目自动切换中英文
    Java线程池ThreadPoolExecutor使用和分析(三)
    Java线程池ThreadPoolExecutor使用和分析(二)
  • 原文地址:https://www.cnblogs.com/j-c-y/p/10565033.html
Copyright © 2011-2022 走看看