|
pengfei
银牌会员
    
积分 1218
发帖 485
注册 2006-7-21 来自 湖南.娄底
状态 离线
|
『第 31 楼』:
使用 LLM 解释/回答一下
不知哪位兄台能搞到文本格式的英汉字典, 这样做起来更爽...
I wonder which fellow can get a text - format English - Chinese dictionary, this way it will be more enjoyable...
|
|
2006-10-13 02:44 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 32 楼』:
使用 LLM 解释/回答一下
字典的格式需要自己来定义,不用找现成的字典,否则,很难用CMD来处理。
如果只要字典的内容的话,可以用无奈何兄所发的金山词霸字典提取工具来提取内容,不过提取出来的内容比较凌乱。
The format of the dictionary needs to be defined by yourself. Don't look for ready-made dictionaries. Otherwise, it's difficult to handle with CMD.
If you only want the content of the dictionary, you can use the Kingsoft Word霸 dictionary extraction tool posted by Brother Wunaixie to extract the content. However, the extracted content is relatively messy.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-13 06:34 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 33 楼』:
2006-10-14更新
使用 LLM 解释/回答一下
贴一个中英文互译的初步代码出来,能初步检测一些出错的情况。
由于加入了显示具有相同头部或具有相同词义的所有单词的功能,不能再用 for /l %%i in (1,1,10000) do (>>词库.txt echo var) 的方法创建上万行的词库文件来测试,所以只做了功能测试而没做效率测试,如果哪位兄弟可以搞到能满足这个代码格式要求的词库文件,请告诉我方法或者放出文件,不胜感激。
再次强调,成败的关键在于词库文件的格式。
@echo off
:: 功能:
::
:: ① 输入英文,显示该英文条目下的所有内容;
:: 同时显示词库中存在的、词义相同或头部相同的其他单词;
:: ② 输入汉语,显示词义中包含该汉语词汇的所有英文
::
:: 词库文件的格式要求:
::
:: 文件第一行内容必须为空,或者不能出现要查找内容的正文
:: 一个段落块的首行必须为纯英文词汇
:: 中文翻译内容紧接着另起一行(不允许出现纯字母行),可以有多行
:: 翻译之下可以有举例内容
:: 每个解释后面加中文半角状态下的分号和空格
:: 解释内容可以在同一行,也可以在不同行
:: 解释之下的举例内容尽量避免出现中文半角状态下的分号和空格连用的情况
:: 每个段落块允许使用空行分隔
::
:: code by JM 2006-10-11~14 http://www.cn-dos.net Thanks to 3742668
:input_var
title 英汉互译器
cls
set line=
set postil=
set postil_content=
set similar=
set input=
set /p input=请输入要查询的内容(要退出请直接回车):
if "%input%"=="" exit
ren ============== 判断输入类型 ==============
cls
echo %input%|findstr "^*$">nul && goto letters || goto not-letters
ren ============== 英译汉 ==============
:letters
title 英汉互译器-英译汉
:: 先提取匹配单词的第一条记录的行数,然后再从这行之下查找第一次出现的单词
:: 两个单词之间的内容就是英文的翻译
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" 词库.txt') do (
if /i "%%j"=="%input%" set line=%%i&goto word_finded
)
if "%line%"=="" goto no-item
:word_finded
echo _________________________________
echo 要查找的单词:%input%
echo.
setlocal enabledelayedexpansion
for /f "skip=%line% delims=" %%i in (词库.txt) do (
echo %%i|findstr "^*$">nul &&(goto no-postil)||(
echo %%i&if not "%%i"=="" set postil=exist
echo %%i|findstr /c:"; ">nul &&(
set postil_content=!postil_content!%%i
)
)
)
:no-postil
if "%postil%"=="" (echo %input% 条目下没有任何内容 & goto end)
echo _________________________________
echo 词义类似的单词:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nr "%postil_content%" 词库.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_similar
)
if "%similar%"=="" echo 暂无。
echo _________________________________
echo 头部相同的其他词汇:
echo.
set similar=
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" 词库.txt') do (
echo %%j|findstr "^*">nul && (
if not "%%j"=="%input%" set similar=exist&echo %%j
)
)
if "%similar%"=="" echo 暂无。
:end
echo _________________________________
echo.
pause
goto input_var
:check_similar
:: 查找词义中含有%postil_content%的所有英文词汇
for /f "skip=%line% delims=" %%i in (词库.txt) do (
echo %%i|findstr "^*$">nul &&(
if not "%%i"=="%input%" (
echo %%i&set similar=exist&goto :eof
) else (goto :eof)
)||(set /a line=%line%-1& goto check_similar)
)
goto :eof
ren ============== 汉译英 ==============
:not-letters
title 英汉互译器-汉译英
:: 先提取包含该汉语词汇的第一条记录的行数,然后再查找位于该行之上的纯字母行
:: 则第一次找到的纯字母行就是要查找的英文单词
:: 重复以上过程就可以查找到词义中包含这个汉语词汇的所有英文词汇
echo _________________________________
echo.
echo %input%:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nrc:"%input%; " 词库.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_word
)
if "%postil%"=="" goto no-item
echo _________________________________
echo.
pause
goto input_var
:check_word
:: 查找词义中含有%input%的所有英文词汇
set postil=exist
for /f "skip=%line% delims=" %%i in (词库.txt) do (
echo %%i|findstr "^*$">nul &&(echo %%i&&goto :eof)||(
set /a line=%line%-1&& goto check_word
)
)
goto :eof
ren ============== 出错提示 ==============
:no-item
cls
echo _________________________________
echo.
echo %input%:
echo 没有找到该条目!
echo _________________________________
echo.
pause
goto input_var
Last edited by namejm on 2006-10-15 at 00:40 ]
Post a preliminary code for Chinese-English mutual translation, which can initially detect some error situations.
Because the function of displaying all words with the same header or the same meaning has been added, the method of using for /l %%i in (1,1,10000) do (>> word bank.txt echo var) to create a word bank file with tens of thousands of lines for testing can no longer be used. Therefore, only functional testing has been done and not efficiency testing. If any brother can obtain a word bank file that meets the format requirements of this code, please tell me the method or release the file. I would be very grateful.
Once again, it is emphasized that the key to success or failure lies in the format of the word bank file.
@echo off
:: Function:
::
:: ① Enter English, display all contents under the English entry;
:: At the same time, display other words with the same meaning or the same header in the word bank;
:: ② Enter Chinese, display all English words whose meanings contain the Chinese vocabulary
::
:: Format requirements for the word bank file:
::
:: The first line of the file must be empty, or the text of the content to be searched must not appear
:: The first line of a paragraph block must be a pure English vocabulary
:: The Chinese translation content is immediately on the next line (no pure letter lines are allowed), and there can be multiple lines
:: Examples can be below the translation
:: Add a Chinese half-width semicolon and space after each explanation
:: The explanation content can be in the same line or in different lines
:: Try to avoid the situation where the example content below the explanation is connected with a Chinese half-width semicolon and space
:: Empty lines are allowed to separate each paragraph block
::
:: code by JM 2006-10-11~14 http://www.cn-dos.net Thanks to 3742668
:input_var
title Chinese-English Translator
cls
set line=
set postil=
set postil_content=
set similar=
set input=
set /p input=Please enter the content to be queried (press Enter directly to exit):
if "%input%"=="" exit
ren ============== Determine input type ==============
cls
echo %input%|findstr "^*$">nul && goto letters || goto not-letters
ren ============== English to Chinese ==============
:letters
title Chinese-English Translator-English to Chinese
:: First extract the line number of the first record that matches the word, then find the first occurrence of the word below this line
:: The content between the two words is the translation of English
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" word bank.txt') do (
if /i "%%j"=="%input%" set line=%%i&goto word_finded
)
if "%line%"=="" goto no-item
:word_finded
echo _________________________________
echo The word to be found: %input%
echo.
setlocal enabledelayedexpansion
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(goto no-postil)||(
echo %%i&if not "%%i"=="" set postil=exist
echo %%i|findstr /c:"; ">nul &&(
set postil_content=!postil_content!%%i
)
)
)
:no-postil
if "%postil%"=="" (echo There is no content under the entry of %input% & goto end)
echo _________________________________
echo Words with similar meanings:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nr "%postil_content%" word bank.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_similar
)
if "%similar%"=="" echo None for the time being.
echo _________________________________
echo Other words with the same header:
echo.
set similar=
for /f "tokens=1* delims=:" %%i in ('findstr /nirc:"^%input%" word bank.txt') do (
echo %%j|findstr "^*">nul && (
if not "%%j"=="%input%" set similar=exist&echo %%j
)
)
if "%similar%"=="" echo None for the time being.
:end
echo _________________________________
echo.
pause
goto input_var
:check_similar
:: Find all English words whose meanings contain %postil_content%
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(
if not "%%i"=="%input%" (
echo %%i&set similar=exist&goto :eof
) else (goto :eof)
)||(set /a line=%line%-1& goto check_similar)
)
goto :eof
ren ============== Chinese to English ==============
:not-letters
title Chinese-English Translator-Chinese to English
:: First extract the line number of the first record that contains the Chinese vocabulary, then find the pure letter line above this line
:: Then the first pure letter line found is the English word to be found
:: Repeat the above process to find all English words whose meanings contain this Chinese vocabulary
echo _________________________________
echo.
echo %input%:
echo.
for /f "tokens=1* delims=:" %%i in ('findstr /nrc:"%input%; " word bank.txt') do (
if not "%%j"=="" set /a line=%%i-2&& call :check_word
)
if "%postil%"=="" goto no-item
echo _________________________________
echo.
pause
goto input_var
:check_word
:: Find all English words whose meanings contain %input%
set postil=exist
for /f "skip=%line% delims=" %%i in (word bank.txt) do (
echo %%i|findstr "^*$">nul &&(echo %%i&&goto :eof)||(
set /a line=%line%-1&& goto check_word
)
)
goto :eof
ren ============== Error prompt ==============
:no-item
cls
echo _________________________________
echo.
echo %input%:
echo The entry is not found!
echo _________________________________
echo.
pause
goto input_var
Last edited by namejm on 2006-10-15 at 00:40 ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-13 12:42 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 34 楼』:
使用 LLM 解释/回答一下
今天突然想到,用33F的思路可以写一个公交线路信息查询器之类很实用的东西,预计可以实现如下两个功能:
① 输入线路名称,显示该线路的所有站点及发车收车时间;
② 输入上车站点和下车站点,显示可搭乘的车次,并显示每条线路中这两个站点及其之间的所有站点及发车收车时间;
有兴趣的不妨尝试着去做一做。
——————————————————————————————————————
公交线路信息查询器的代码已经放出来了,请点 这里 查看。
Last edited by namejm on 2006-11-15 at 01:37 PM ]
Today I suddenly thought that using the idea of 33F, a very practical thing like a public transportation route information query tool can be written. It is expected to achieve the following two functions:
① Enter the route name, and display all the stops of this route and the departure and arrival times;
② Enter the departure stop and the arrival stop, display the available trips, and display all the stops between these two stops in each route and the departure and arrival times;
Those who are interested may try to do it.
——————————————————————————————————————
The code of the public transportation route information query tool has been released. Please click here to view.
Last edited by namejm on 2006-11-15 at 01:37 PM ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-10-17 12:11 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 35 楼』:
使用 LLM 解释/回答一下
② 输入上车站点和下车站点,显示可搭乘的车次,并显示每条线路中这两个站点及其之间的所有站点及发车收车时间;
这个复杂了,要判断这些车次的交汇点估计不是易事,而且有可能有3次以上车次
② Enter the departure and arrival stations, display the trains that can be taken, and display all stations between these two stations in each line and the departure and arrival times;
This is complicated. It is estimated that it is not easy to judge the intersection points of these trains, and there may be more than 3 trains.
|
|
2006-10-17 13:43 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 36 楼』:
使用 LLM 解释/回答一下
不管做什么."数据库"txt的格式很重要
No translation needed as the content is already in Chinese but the task is to translate from Chinese to English. Wait, no, the original text is "不管做什么."数据库"txt的格式很重要", which should be translated as "No matter what you do, the format of the 'database' txt is very important".
|
|
2006-10-18 05:49 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 37 楼』:
使用 LLM 解释/回答一下
Originally posted by namejm at 2006-10-17 12:11:
今天突然想到,用33F的思路可以写一个公交线路信息查询器之类很实用的东西,预计可以实现如下两个功能:
有兴趣的不妨尝试着去 ...
namejm这想法有意思,可要记在本上留好~:)
到处都是公交查询系统,还有学生毕业设计,但是DOS批处理版的估计除了少数DOS高手之外没有什么人可以想像的到DOS照样可以做这些,并且很快:)
给版主加上1分~:)
Originally posted by namejm at 2006-10-17 12:11:
Today I suddenly thought that using the idea of 33F, one can write a very practical thing like a public transportation route information query tool. It is expected to achieve the following two functions:
Those who are interested might as well try to...
namejm's idea is interesting, and it should be noted and kept well in mind~ : )
There are public transportation query systems everywhere, and there are also graduation projects for students. But for the DOS batch processing version, except for a few DOS experts, few people can imagine that DOS can still do these things, and it is very fast : )
Add 1 point to the moderator~ : )
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-10-18 07:14 |
|
|
redtek
金牌会员
     
积分 2902
发帖 1147
注册 2006-9-21
状态 离线
|
『第 38 楼』:
使用 LLM 解释/回答一下
Originally posted by zxcv at 2006-10-17 13:43:
这个复杂了,要判断这些车次的交汇点估计不是易事,而且有可能有3次以上车次
这些好的思想和创造它的工具可以影响很多人对某一件事情的想法和了解的深度~:)
再难的东东还可以留给 “批处理大赛活动” 中使用~:)
这真是开始接触从底层考虑和分析一些东东了,哈哈……
有多少程序员每天用着SQL查询着n多的东东,并且命令玩得很炫!
但是,又有多少程序员知道他们正在用的SQL或其它查询的底层里到底做的什么……
这些可能对99%的都不重要,应用就是生产的过程:)
相信还有创造的过程也是非常精彩,它将留给更喜欢它的人去做得更精彩~:)
zxcv有什么好想法和算法快说出来啊~:)
Originally posted by zxcv at 2006-10-17 13:43:
This is complicated. It is estimated that it is not easy to judge the meeting points of these train numbers, and there may be more than 3 train numbers.
These good ideas and the tools that create them can influence many people's thoughts and the depth of their understanding of a certain thing ~:)
More difficult things can still be left for use in the "Batch Processing Competition Activity" ~:)
This is really starting to contact and analyze some things from the bottom level, haha...
How many programmers use SQL to query many things every day and play with commands very brilliantly!
But how many programmers know what is actually done in the underlying layer of the SQL or other queries they are using...
These may not matter to 99%, and application is the process of production ~:)
I believe that the process of creation is also very wonderful, and it will be left for those who like it more to make it more wonderful ~:)
zxcv, hurry up and tell us your good ideas and algorithms ~:)
|

Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._ |
|
2006-10-18 07:20 |
|
|
goodfile
初级用户
 
积分 112
发帖 6
注册 2005-6-29
状态 离线
|
|
2006-10-23 01:02 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 40 楼』:
使用 LLM 解释/回答一下
20F namejm 版主的脚本查找 10W 行未发现问题,结果转瞬间就出来了。
Last edited by zxcv on 2006-10-29 at 02:02 AM ]
20F namejm moderator's script search, no problems found in 100,000 lines, the result came out in an instant.
Last edited by zxcv on 2006-10-29 at 02:02 AM ]
|
|
2006-10-28 12:39 |
|
|
zouzhxi
中级用户
   蝴蝶之吻
积分 430
发帖 177
注册 2006-9-20 来自 广东深圳
状态 离线
|
|
2006-11-15 07:43 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 42 楼』:
使用 LLM 解释/回答一下
Originally posted by zouzhxi at 2006-11-14 18:43:
只要把namejm版主的BAT稍稍改了一下,就成了DOS版的通讯录了...
下面我把截图给大家看看...
暂时还不能实现修改功能,只能手工去库里边修改。
请问你想修改成什么样子?是用某些字符去替换另外一些字符,还是增添内容,或者删除记录?我所问到的这些功能,有些是可以在批处理里解决的。
Last edited by namejm on 2006-11-14 at 07:23 PM ]
Originally posted by zouzhxi at 2006-11-14 18:43:
Just modified the BAT of moderator namejm a little, and it became a DOS version of the address book...
Now I'll show you the screenshots...
Modification function is not available for the time being, and you can only modify it manually in the database.
What kind of modification do you want to make? Do you want to replace certain characters with others, add content, or delete records? Some of these functions I asked about can be solved in batch processing.
Last edited by namejm on 2006-11-14 at 07:23 PM ]
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-15 08:21 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 43 楼』:
使用 LLM 解释/回答一下
他的意思是修改或删除某人的资料,添加倒是很方便,echo>>就OK了
His meaning is to modify or delete someone's information. Adding is quite convenient, just echo>> will do.
|
|
2006-11-15 09:29 |
|
|
namejm
荣誉版主
       batch fan
积分 5226
发帖 1737
注册 2006-3-10 来自 成都
状态 离线
|
『第 44 楼』:
使用 LLM 解释/回答一下
删除某项记录也挺方便的,只不过是要生成临时文件,思路是:用 findstr /v 来过滤你要删除的内容,然后把要保留的内容 echo 到临时文件中去,再用这个临时文件覆盖掉当前数据库。难点有两处:1:如何精确地过滤掉想删除的记录。可通过 findstr 的正则表达式来解决;2、如何获取要过滤的信息块。可配合 for 语句中的 skip 来解决。
Deleting a certain record is also quite convenient. It's just that a temporary file needs to be generated. The idea is: use findstr /v to filter the content you want to delete, then echo the content that needs to be retained to the temporary file, and then use this temporary file to overwrite the current database. There are two difficulties: 1. How to accurately filter out the record you want to delete. This can be solved by using the regular expression of findstr; 2. How to obtain the information block to be filtered. This can be solved in combination with skip in the for statement.
|

尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。 |
|
2006-11-15 09:47 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 45 楼』:
使用 LLM 解释/回答一下
删除某项电话本记录:
bat
@echo off
echo.
set /p 删除人员= 删除人员:
>TelN.db echo ::电话本数据库
>>TelN.db echo --------------------------------------------------
>>TelN.db echo.
setlocal EnableDelayedExpansion
for /f "delims=" %%i in (Tel.db) do (
if "%%i" == "::" set /a Num+=1
)
set Delete=echo
for /f "skip=3 delims=" %%i in (Tel.db) do (
if "%%i" == "%删除人员%" set Delete=rem&&set /a N-=1
!Delete! %%i>>TelN.db
if "%%i" == "::" !Delete!.>>TelN.db&&set /a N+=1&&cls&&echo.&&echo !N!/%Num%&&set Delete=echo
)
pause
exit
Tel.db
::电话本数据库
--------------------------------------------------
张三
联系人姓名:张三
联系人电话:张三
联系人地址:张三
联系人单位:张三
::
李四
联系人姓名:李四
联系人电话:李四
联系人地址:李四
联系人单位:李四
::
王五
联系人姓名:王五
联系人电话:王五
联系人地址:王五
联系人单位:王五
::
Last edited by zxcv on 2006-11-15 at 09:24 AM ]
Delete a certain phone book record:
bat
@echo off
echo.
set /p deletePerson= Delete person:
>TelN.db echo ::Phone book database
>>TelN.db echo --------------------------------------------------
>>TelN.db echo.
setlocal EnableDelayedExpansion
for /f "delims=" %%i in (Tel.db) do (
if "%%i" == "::" set /a Num+=1
)
set Delete=echo
for /f "skip=3 delims=" %%i in (Tel.db) do (
if "%%i" == "%deletePerson%" set Delete=rem&&set /a N-=1
!Delete! %%i>>TelN.db
if "%%i" == "::" !Delete!.>>TelN.db&&set /a N+=1&&cls&&echo.&&echo !N!/%Num%&&set Delete=echo
)
pause
exit
Tel.db
::Phone book database
--------------------------------------------------
Zhang San
Contact name: Zhang San
Contact phone: Zhang San
Contact address: Zhang San
Contact unit: Zhang San
::
Li Si
Contact name: Li Si
Contact phone: Li Si
Contact address: Li Si
Contact unit: Li Si
::
Wang Wu
Contact name: Wang Wu
Contact phone: Wang Wu
Contact address: Wang Wu
Contact unit: Wang Wu
::
Last edited by zxcv on 2006-11-15 at 09:24 AM ]
|
|
2006-11-15 13:12 |
|