掌上百科 - PDAWIKI

 找回密码
 免费注册

QQ登录

只需一步,快速开始

查看: 4141|回复: 9

[求助] Word and phrase origins[2008版, 高清, 可复制]

[复制链接]
  • TA的每日心情
    擦汗
    2026-5-17 21:46
  • 签到天数: 45 天

    [LV.5]常住居民I

    发表于 2013-9-27 17:46:08 | 显示全部楼层 |阅读模式
    请各位看看这个http://www.baidu.com/link?url=YB ... igasAC20NXFW8hNMJda, 看看能否转换成mdx

    该用户从未签到

    发表于 2013-9-28 05:30:27 | 显示全部楼层
    dingyang 发表于 2013-9-27 23:06
    " _  p, l. X4 Z5 O+ u3 |4 l" aPDF很难转成mdx的

    & C3 k. S1 l+ O{:5_227:}也不难,就是不管高手、低手,估计最低也得耗上两百个小时,才能把楼主链接里的pdf,做成能见人的mdx。
    / W# o# s9 V2 }: M6 @文本版的pdf,跟扫描版的pdf相比,也就省了OCR一步,距离能直接build为mdx的txt还有十万八千里呢。6 Z5 s- y6 e1 o6 O- j

    ( \; \8 s& S3 y0 v- b- l$ USelf-help is better than help from others; God helps those that help themselves.自己动手、丰衣足食啊。谁感兴趣谁动手啊。/ [! K+ T  J8 ~2 {
    提供几个思路  j. I7 h& d$ {4 H" G; @3 u
    1. pdf转html,这样pdf里词头的加粗可能得以保留,但是会有很多问题,因为pdf页面里内容是两栏,转成html后内容会出现错位的情况,最后让人心力交瘁,还不如一条一条复制粘贴。
    . d$ N! i+ ?7 k2. pdf转word,pdf的两栏可能就变成文本框了,这样操作起来稍微简单些,但是最后说不定会发现,还是不如一条一条复制粘贴。( a3 n- x2 @( [- S# F2 x1 n
    未实际操作,供参考。

    评分

    1

    查看全部评分

  • TA的每日心情
    开心
    2019-8-21 08:44
  • 签到天数: 163 天

    [LV.7]常住居民III

    发表于 2018-11-25 16:50:10 | 显示全部楼层
    本帖最后由 mikeee 于 2018-11-25 18:08 编辑
    # y9 z; A! D9 @  {8 S1 T  [0 v  L4 `! p% j8 u) d# W6 k
    有一个办法应该可行:先用 Abbyy Finereader 转成 docx,docx再转成 htm。
      d& R; [9 {1 N& `, s' N( n3 r5 w9 G' [3 g( U7 b4 I" [
    我机器里没装Finereader,用在线 https://finereaderonline.com 做了十页(每天在线只能OCR十页),效果不错:htm里的页头自动消失。两列变成了单列,粗体保留,好像原pdf换行时的 hyphen 都去掉了,但原pdf里跨页的段落好像没有合并。
    1 f' X  ?# o; i8 i7 W+ [8 }- o9 F# _* A. c9 n6 O0 P; d# Q7 F
    Chrome Devtools 大致看了看:css selector: p.Bodytext21 可定位所有的释义" h; Z* ~0 ^( b
    css selector:p.Bodytext21>span.Bodytext2Bold 可定位释义里的粗体' I( f, r: C0 y; \: Q' j
    8 S+ ^* t6 b/ t- {& w! }
    贴不了图,发个 docx 和 htm 文件(仅10页) 百度盘链接: https://pan.baidu.com/s/15Qc4tQeWcePy7AhTJLiJXQ 提取码: encg
    , h; Z( R1 Y3 N( [$ N. J& r' J% V, R: h3 B: i/ X6 W
    折腾了一阵,这个 python3 码处理上面说的 htm 得到的东西大致可以做成 mdx
    & l1 P, f3 X8 \) @" P( G9 o
    1. '''word and phrase orgins test; I4 [. d- E% X
    2. '''' R8 d7 g) Z/ ^: l: g
    3. from pyquery import PyQuery as pq
      ; `  I6 w; h- \5 K( r! J

    4.   ?( ~7 V  B3 z* L% s
    5. file = r'WordandPhraseOrigins.htm'
        {0 v6 J! e" p
    6. try:
      2 c2 `% ]% v2 o) e* p" l. `% _
    7.     html = open(file, 'rt', encoding='utf8').read()
      # O$ Z( S$ e& k% w
    8. except Exception as exc:
      ! s* h) W" d5 C
    9.     print('error: {}. Trying gb2312...'.format(exc))' N8 |% k. z/ {+ [, x3 y9 J: `
    10.     try:+ W( `' q9 [: @; V% \% o, E
    11.         html = open(file, 'rt', encoding='gb2312').read()
      - r" ?" p' L0 Q' s1 u2 K& }( I( B! I
    12.         print('Looks good')
      / p0 A  C! I- f8 E" P' E
    13.     except Exception as exc:
      % S- U, |5 ]+ i! M/ L# `6 p! q
    14.         SystemExit('error: {}. Giving up...'.format(exc))
      - l7 w" d; l0 \: k! O, u
    15. doc = pq(html)
      ! j% U& ?0 Z/ G+ |8 k3 R9 d9 n

    16. & J$ L. j" k3 W+ C3 C0 E$ n, q
    17. css_text = 'p.Bodytext21'3 k- W! m3 ^* }
    18. css_bold = 'p.Bodytext21>span.Bodytext2Bold'5 t2 S5 I; g+ q
    19. ! z7 c: o+ k! R4 y/ ]5 q- F& B
    20. items = doc(css_text)8 Z' O* w! c0 q8 n

    21. * b+ W$ V3 L0 [( h, O
    22. text = doc(css_text).map(lambda idx, elm: pq(elm)(
      9 X3 V5 r. x' d2 g# z
    23.     'span.Bodytext2Bold').text() + ('(hw)\n' if pq(elm)('span.Bodytext2Bold').text() else '\n') + pq(elm)('span.Bodytext20').text())
      ! U" c" D  y, b! X
    24. print('\n\n'.join(text[:60]))! b+ M2 h4 q5 e' [1 e- Z
    复制代码
    上面码的输出大致这个样子:
    。。。, C' F# x# F' D# @9 E3 V- J
    A-Rod.(hw)2 N. ^0 i8 C2 I# T* M
    People who have little or no knowledge of baseball might have trouble with these initials. They are short for Alex Rodriguez, the famous Yankee baseball star.
    $ W" u8 g. b/ F8 T, F5 n* X  d
    3 E# e. j  ^& r* v& {around Cape Horn.(hw)
    . @. T1 p7 Y' uAn expression once used in whaling communities to mean “being away on a whaling voyage.” One old poem went:. R1 J' F4 O( \  B/ I, J8 o/ \
    ! W  \5 V$ j  x4 e

    ( g7 D8 _9 P% |$ t; G$ j“I’ll tell your father, boys,” I cried To lads at play upon my lawn.9 m+ \8 H- o7 i2 a" S

    # g4 B2 q: c/ s% y4 _% i; U' q3 x/ C% g# _0 Z4 A" U
    They chorused back, “You’ll have to go Around Cape Horn.”9 C- ?; j' i  e- e! m3 X

    * h* k; ?. R) m4 r) W$ I  F; raround the horn.(hw)
    - Y; |, K& T+ D+ M" D- @: yIn the days of the tall ships any sailor who had sailed around Cape Horn was entitled to spit to windward; otherwise, it was a serious infraction of nautical rules of conduct. Thus, the permissible practice of spitting to windward was called Cape Horn isn’t so named because it is shaped like a horn. Captain Schouten, the Dutch navigator who first rounded it in 1616, named it after Hoorn, his birthplace in northern Holland.( {1 k1 @- u3 D
    ! ^5 j  l6 {. h
    arrant thief; knight errant.(hw)
    7 ]" H, q1 p6 J, ]  C6 {" i1 awas originally just a variation of nomadic or vagabond, the word best known in a knight who roamed the country performing good deeds. But from its persistent use in expressions such as an a thief who roamed the countryside holding up victims, came to mean thorough, downright, or out-: a- J; J# q& \% g
    。。。

    . }2 e* o3 r9 `" v& d1 j1 d
    顺便安利一下 pyquery,是不是完爆正则、bs4、lxml
      Z' C+ t! C7 m: W: v
    0 v( r8 ?4 ~; A$ {
    : g: q2 i  b0 j- g6 ^  ^, B5 b  ]) \$ m' U0 G) T9 Q

    评分

    1

    查看全部评分

  • TA的每日心情

    2023-8-3 00:11
  • 签到天数: 1 天

    [LV.1]初来乍到

    发表于 2013-9-27 23:06:41 | 显示全部楼层
    PDF很难转成mdx的
  • TA的每日心情
    开心
    2019-9-3 09:48
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    发表于 2013-9-29 17:38:36 来自手机 | 显示全部楼层
    pdf转 txt,格式有一定规律, 编程处理后可以做成mdict词库,我正在编程处理……
  • TA的每日心情
    开心
    2019-8-11 07:55
  • 签到天数: 606 天

    [LV.9]以坛为家II

    发表于 2013-9-29 20:56:28 | 显示全部楼层
    shbf 发表于 2013-9-29 17:38 $ U& i& K- A0 @0 |$ H3 u, D
    pdf转 txt,格式有一定规律, 编程处理后可以做成mdict词库,我正在编程处理……
    ) h0 x* w! o# e9 _4 k. v! h2 m
    期待新作品,辛苦了。
  • TA的每日心情
    擦汗
    2026-5-17 21:46
  • 签到天数: 45 天

    [LV.5]常住居民I

     楼主| 发表于 2013-10-1 14:30:14 | 显示全部楼层
    shbf 发表于 2013-9-29 17:38 3 O* f  M. s& n1 c4 x' q5 T
    pdf转 txt,格式有一定规律, 编程处理后可以做成mdict词库,我正在编程处理……

    3 H+ _) U' U8 G& Y" R! S8 X+ P# N; p期待新作品,辛苦了。Many thanks! {:5_213:}
  • TA的每日心情
    开心
    2019-9-3 09:48
  • 签到天数: 3 天

    [LV.2]偶尔看看I

    发表于 2013-10-5 09:07:51 来自手机 | 显示全部楼层
    词典文本已导出并处理……基本无误,两栏问题完美解决。
    ! |" E, y: T, r4 n( x( {0 t; D) ]8 A& p* _4 \. V7 Y+ d$ d( Y' E4 y' {4 ]. m
    主要遗留一些小缺点,可以自行纠正,1. 部分.,)后面少一个空格。2.部分年份数字和英文单词之间少一个空格。这两个问题很好解决的。
    9 X" c; L4 ~+ `. O; W
    , J6 X+ I. M7 X3 J1 S当然要做成mdx,还需把关键词标记出来,我用{}标记到字母C, 剩下的需要对照pdf,工作量有点大,不做了。发上源文本,请有时间的网友处理吧!9 y. k, u1 v, n9 y
    http://pan.baidu.com/share/link?shareid=1686563253&uk=3759036089
  • TA的每日心情
    奋斗
    2019-3-25 01:00
  • 签到天数: 99 天

    [LV.6]常住居民II

    发表于 2018-11-24 22:20:14 | 显示全部楼层
    感谢 shbf 兄的辛勤工作。
  • TA的每日心情
    开心
    2019-8-21 08:44
  • 签到天数: 163 天

    [LV.7]常住居民III

    发表于 2018-12-27 13:39:42 | 显示全部楼层
    做成了 mdx 毛坯版,不完美,但可以用了,会找时间完善一下。15米,相当于免费的吧。& L3 U0 H+ u7 v! {
    下载mdx:https://www.pdawiki.com/forum/fo ... p;extra=#pid10359232 ^$ i1 T" ]/ B: T
    ' C, @6 @3 W9 _$ k1 b
    欢迎制作校对精美版,可免费提供从 pdf 到 mdx 各环节的资料(文本,python程序等等)。详细步骤及相关资料可参考此贴 https://www.pdawiki.com/forum/fo ... &extra=page%3D1
    您需要登录后才可以回帖 登录 | 免费注册

    本版积分规则

    小黑屋|手机版|Archiver|PDAWIKI |网站地图

    GMT+8, 2026-8-1 11:45 , Processed in 0.024006 second(s), 27 queries .

    Powered by Discuz! X3.4

    © 2001-2023 Discuz! Team.

    快速回复 返回顶部 返回列表