118 lines
4.5 KiB
Plaintext
118 lines
4.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "f02a8ab8-2e27-493a-91d9-e0dffae99a62",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 37,
|
|
"id": "0d209bb5-6977-4c7c-b6d9-414e5ce7e9f1",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2024-07-06T16:09:02.127946Z",
|
|
"iopub.status.busy": "2024-07-06T16:09:02.127230Z",
|
|
"iopub.status.idle": "2024-07-06T16:09:07.516855Z",
|
|
"shell.execute_reply": "2024-07-06T16:09:07.514750Z",
|
|
"shell.execute_reply.started": "2024-07-06T16:09:02.127875Z"
|
|
}
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"./pic/071.jpg\n",
|
|
"之势力主义者固都可称为新布局法也然自围棋自身的幽玄微妙之境看来实亦无所谓新旧从广义言之三连星亦不过是一种偏在的手法因观点不同故布局时所定之方针亦异而已顾新旧两法虽因形式不同演出之经纬遂大相差异然其间却仍有不可分离之连系在是以固执成见墨守陈法固不足取而徒炫新奇盲目模拟者亦岂足称道总之切不可囚于浅薄的形式主义致陷食而不化之弊至若技艺已达圆熟之境则不论依新依旧无不变通自在皆收良好之效果若夫一切未具根底徒以为新法必胜漫然仿效则正如童孺之玩火要知临局交锋能着着保持均势此虽在高品犹属不易何况本无素养之人而亟欲依新布局之精神作有效之行使得勿谓为难中之难事乎盖凡是一种标准之布局法则大都均有其独特性高手用之便成一家法即所谓「作风」然此必须先行澈究前贤之所已经发明然后方能造古人未至之境比如学书必由正而草若徒慕张旭怀素辈之走笔龙蛇而不研习其基本功夫才一握管即思满纸云烟是乌可得恐结果无不演成丑态百出也虽然调和势力与地域融合新旧在其间建立一种基本之布局法则实为现今棋界所企盼学无止境愿我国同道努力目前之争论固无非是研究期间之一过程而已三连星起手式新布局既无确切之标准故初学对之殊难捉摸然关于三连星之运用却可依照六子局之起手法寻得其研究资料\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from aip import AipOcr\n",
|
|
"import glob\n",
|
|
"from opencc import OpenCC\n",
|
|
"import time\n",
|
|
"\"\"\" 你的 APPID AK SK \"\"\"\n",
|
|
"APP_ID = '17553946'\n",
|
|
"API_KEY = 'IMC1ss3Tyo3vEAdVH6jgcdv2'\n",
|
|
"SECRET_KEY = 'Iua6KdhuDtz159rjzGeFGpqgjhnoU0zZ'\n",
|
|
"\n",
|
|
"client = AipOcr(APP_ID, API_KEY, SECRET_KEY)\n",
|
|
"def get_file_content(filePath):\n",
|
|
" with open(filePath, 'rb') as fp:\n",
|
|
" return fp.read()\n",
|
|
"\n",
|
|
"\n",
|
|
"fi_path = './pic'\n",
|
|
"fls = glob.glob(f'{fi_path}/*.jpg')\n",
|
|
"fls.sort()\n",
|
|
"\"\"\" 调用通用文字识别, 图片参数为本地图片 \"\"\"\n",
|
|
"#client.basicGeneral(image);\n",
|
|
"\n",
|
|
"\"\"\" 如果有可选参数 \"\"\"\n",
|
|
"options = {}\n",
|
|
"options[\"language_type\"] = \"CHN_ENG\"\n",
|
|
"options[\"detect_direction\"] = \"true\"\n",
|
|
"options[\"detect_language\"] = \"true\"\n",
|
|
"options[\"probability\"] = \"true\"\n",
|
|
"#options[\"detect_direction\"] = \"true\"\n",
|
|
"cc = OpenCC('t2s')\n",
|
|
"for fi in fls:\n",
|
|
" image = get_file_content(fi)\n",
|
|
" result= client.basicAccurate(image, options)\n",
|
|
" print(fi)\n",
|
|
" list1 = []\n",
|
|
" if 'words_result' in result:\n",
|
|
" for w in result['words_result']:\n",
|
|
" list1.append(cc.convert(w['words']))\n",
|
|
" print(''.join(list1))\n",
|
|
" time.sleep(5)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "75e8d016-deba-4177-9036-01bfd77002a9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"s = '鬭造出種種'\n",
|
|
"print(cc.convert(s))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "d4df9553-0ded-4c40-bf89-38ee90feecbd",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|