Skip to content

Instantly share code, notes, and snippets.

@yapcheahshen
Last active December 15, 2023 16:29
Show Gist options
  • Save yapcheahshen/295b1e25ccd36ccf9de668654e9addc7 to your computer and use it in GitHub Desktop.
Save yapcheahshen/295b1e25ccd36ccf9de668654e9addc7 to your computer and use it in GitHub Desktop.
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