yantuguiguzi的个人博客分享 http://blog.sciencenet.cn/u/yantuguiguzi

博文

编程学可,翻译亦可

已有 4095 次阅读 2018-4-3 10:26 |系统分类:科研笔记

 知乎链接含图片

https://zhuanlan.zhihu.com/p/35240737

正文共:1531 字 8 图

预计阅读时间: 4 分钟


每次翻译外文文献的时候,把英文复制到谷歌翻译,会出现PDF格式的文本的换行很麻烦,需要手动来删除换行,影响翻译时思考的质量。


想起最近学的python编程,我可不可以用python来解决这个问题呢?

答案是:经过2个小时的努力,可以了。


在公众号服务窗口,输入:  翻快点

即可得到所需安装包及文件。


安装完python3.6.5.exe后,搜索 idle.exe 并打开。

新建文件(New File ),输入

with open('etext.txt','r') as fp:

data = fp.readlines()

data = [line.strip() for line in data]

data = ','.join(data)

data = data.split(',')

data = ' '.join(map(str,data))

with open('welltext.txt','w') as fp:

fp.write(data)


即成了这样


将你复制的PDF格式的文字,粘贴到自己新建的 etext.txt文件


按 F5 运行这个程序代码(即 run module)


就可以得到连续一行格式的 welltext.txt文件了


例子:

这样就能将

  1. It is widely recognized that a visual texture, which humans

  2. can easily perceive, is very difficult to define [17]. The difficulty

  3. results mainly from the fact that different people can define textures

  4. in application-dependent ways or with different perceptual

  5. motivations, and there is no generally agreed-upon definition

  6. [44]. It is not our intention to add here a new one: we simply

  7. observe that it should be as general as possible, because a too

  8. strict definition would allow one to confine his/her work to images

  9. that better fit with it, eventually leading to narrow-domain

  10. solutions.

转换成

  1. It is widely recognized that a visual texture  which humans can easily perceive  is very difficult to define [17]. The difficulty results mainly from the fact that different people can define textures in application-dependent ways or with different perceptual motivations  and there is no generally agreed-upon definition [44]. It is not our intention to add here a new one: we simply observe that it should be as general as possible  because a too strict definition would allow one to confine his/her work to images that better fit with it  eventually leading to narrow-domain solutions.

在谷歌翻译里就是从这样

到这样

编程学可,翻译亦可

在公众号服务窗口,输入: 翻快点

即可得到所需安装包及文件。

 知乎链接含图片

https://zhuanlan.zhihu.com/p/35240737

2017-07-04-2327544148.png




https://blog.sciencenet.cn/blog-3292245-1107116.html

上一篇:衡山嘻游记
下一篇:董教授讲座之城市的灵魂
收藏 IP: 218.77.77.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-12-21 21:58

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部