Page 1 of 2

Quick search for Chinese characters

Posted: 2009-05-26, 15:57 UTC
by Shanny
2ghisler(Author)

I'm the author of QuickSearchPro, an enhanced quick search tool to support first letter of PinYin search in Chinese.
Here http://www.ghisler.ch/board/viewtopic.php?t=22112&postdays=0&postorder=asc&start=15
I leart that you'll develop "separate phonetic searches for Chinese" soon, I think the related source code of QuickSearchPro maybe useful for this feature, it supports multi-pronunciation PinYin search, and I beleive its PinYin search algorithm is faster than almost all of others.
If you need, I'd like to provide the source code to you unconditionally, or if you have no time, I think I can help to implement the wcmd_chn.dll if you tell me the interface.

Btw: I'm also the auther of F4Menu, will you consider to integrate such F4Menu feature in TC? If yes, I can provide source code as well. :)

Posted: 2009-05-26, 16:33 UTC
by ghisler(Author)
Thanks very much for your offer!

I have already written such a dll for beta 4, and it is very fast. :)

The source will be public, so if your method is faster you can write a faster dll.

Regarding F4Menu: Unfortunately I don't currently have the time to write a similar function, or integrate your solution. The main problem is that it would need additional translations.

Posted: 2009-05-27, 01:52 UTC
by Shanny
Great! looking forward to beta4, when will it be released?

Posted: 2009-05-27, 08:47 UTC
by WatchUer
I guess tomorrow. :wink:

Posted: 2009-05-27, 10:47 UTC
by ghisler(Author)
Probably yes, if all goes well.

Posted: 2009-05-28, 20:30 UTC
by ghisler(Author)
OK, here is the PinYin search (first character only) for TC 7.5 beta 4 now:

Auto-installing dll:
https://plugins.ghisler.com/chinese/PinYinQuickSearch.zip

Source:
https://plugins.ghisler.com/chinese/PinYinQuickSearch_src.zip

IMPORTANT NOTE: You need to close and restart Total Commander after installing the search tool to use it.

I'm using a binary table created from the "Unicode Pinyin table" available here:
http://kanji.zinbun.kyoto-u.ac.jp/~yasuoka/ftp/CJKtable/Uni2Pinyin.Z

To rebuild the table tcmatch.tbl, you need to delete tcmatch.tbl, then unpack Uni2Pinyin.Z (with Z plugin) to TC dir, and rename the file to tcmatch.txt.

Then restart TC and search for some Chinese character. The addon will then automatically rebuild the table.

I have no idea how well it works, it worked OK with all the Chinese characters I tried. The tcmatch.tbl supports up to 3 variations per character. The few characters with more than 3 are handled internally by tcmatch.dll.

The dll interface is very simple:
BOOL __stdcall MatchFileW(WCHAR* Filter,WCHAR* FileName);

Posted: 2009-05-29, 05:21 UTC
by zhv
That's great! Thanks a lot, Mr Ghisler, and Shanny!

It workd fine so far here.

But I suggest the search box could automatically disapear after a short period(which can be configured by the user), just like the QuickSearchPro way!

Posted: 2009-05-29, 15:12 UTC
by Samuel
I wonder if this new search could also be used for something like excluding punctuations:

Code: Select all

Search for: one two

Find Files: one, two.txt one - two.txt
Or for a search like google:

Code: Select all

Search for: one two

Find Files:
one tree two.txt
two tree.one
That would be gr8!

Posted: 2009-05-29, 15:16 UTC
by softy
旺德福
wonderful

Posted: 2009-05-29, 15:22 UTC
by ghisler(Author)
2Samuel
The search dll is for quick search and quick filter only - but you can now write your own search dll for whatever you need!

2zhv
2softy
Thanks for trying it!
But I suggest the search box could automatically disapear after a short period
Hmm, interesting idea, I will consider it as an option. Currently you need to press ESC or start some operation with the file, like ENTER, F3, F4, F5, F6, F8/Del etc.

about tcmatch.dll with pinying

Posted: 2009-05-29, 16:02 UTC
by Csharp
The tcmatch.tbl supports up to 3 variations per character. The few characters with more than 3 are handled internally by tcmatch.dll.
...first variation work well.. but the second and third can't work.

if you can test, try this chinese

4E80 gui1 jun1 qiu1

the chinese is 亀

Posted: 2009-05-29, 16:52 UTC
by Shanny
2ghisler(Author)
Great thanks!
All Chinese users would thank you for this great feature:)

However, you made a very small mistake, hence it cannot work with all multi-pronunciation chars.
I corrected it and now it works fine

fixed code:
http://www.shanny.com.cn/download/PinYinQuickSearch_src_fixed_by_shanny.zip

Auto-installing dll:
http://www.shanny.com.cn/download/PinYinQuickSearch_fixed_by_shanny.zip

Posted: 2009-05-29, 22:24 UTC
by Samuel
Edit: There is probably a bug in it. The funktion "BOOL __stdcall MatchFileW(WCHAR* Filter,WCHAR* FileName);" is only called for all files that doesnt already fit to the filter. For example:

Code: Select all

Filelist:
a.txt
b.txt
c.txt <- cursor
d.txt
e.txt

Filter: "a"

MatchFileW is called with:
c.txt <- because of cursor position
b.txt
c.txt
d.txt
e.txt
Strange: For the file "a.txt" MatchFileW is not called (with filter "a").
(I think its design, but would be a better and more general to call for all files.)

Strange: Why is it called with the file under cursor two times?
Also called for ".." if cursor is on that item although it could not be filtered.

Created a Google-like Quicksearch. Can be downloaded here.

Bug: There are Problems using an Auto-installing dll:
The file could not be overwritten, because TC uses it. Could it be unloaded?

Posted: 2009-05-30, 00:52 UTC
by cheming
2ghisler:

I have tried that feature and it works well for me.

Thank you very very very very much!

Posted: 2009-05-30, 02:08 UTC
by fenix_productions
2ghisler(Author)
Are there real chances to extend MatchFileW method a little bit or add another one?

Currently it gives filter and file name but it would be also great to get visible columns content somehow too.

That way it would be very easy to create something to fit my idea from the past.