Last active
December 15, 2023 16:29
-
-
Save yapcheahshen/295b1e25ccd36ccf9de668654e9addc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {openBasket,nodefs} from 'pitaka/cli'; | |
await nodefs ; //等 fs 準備好 | |
const zh= await openBasket('mzd'); //原文 | |
const en= await openBasket('mzd-en'); //英文版 | |
const [start,end]= zh.getPageRange('antho.1'); // 取得 第一篇文章 中國社會各階級的分析 的範圍, | |
await zh.prefetchLines(start,end); //預讀這個範圍 | |
await en.prefetchLines(start,end); //英版一致 | |
for (let i=start;i<end;i++) { //遍歷 | |
const zhline=zh.getLine(i); //抓取行 | |
const enline=en.getLine(i); | |
console.log(zhline,enline,'\n'); //打印 | |
} | |
/* example of datadump | |
一九二七年所發生的事變,證明了這一點。 This was borne out by the events of 1927. | |
^za1 誰是我們的敵人?誰是我們的朋友?這個問題是革命的首要問題。 ^za1[Who are our enemies? | |
Who are our friends? This is a question of the first importance for the revolution.] | |
中國過去一切革命鬥爭成效甚少,其基本原因就是因為不能團結真正的朋友,以攻擊真正的敵人。 T | |
he basic reason why all previous revolutionary struggles in China achieved so little was their failure to unite with real friends in order to attack real enemies. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment