Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-06-02 Thread ????
> Perhaps there should be a standard string-match-loose which is used for 
> potentially-approximate matches like this and which has a > double handful of 
> configuration options and tweaks that can be fiddled with by prefixes in the 
> search string.

In my opinion, i think it is a kind of  "abbrev-match" instead of 
"string-match".



 
--Barak.--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-06-02 Thread ????
> believe, was concerned
> that typing Chinese names can be cumbersome so that he wanted an
> ascii-based shortcut.


Yes, This is my main focus... 


Nearly every contacts manager in China have this feature.--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-06-01 Thread Roland Winkler
On Tue Jun 2 2015 Roland Winkler wrote:
> Any approximate search will give you yet more matches than what you
> get otherwise.  So it might not always simplify life if you have a
> large BBDB file.

The examples at the bottom of lisp/soundex.el illustrate this quite
well.

--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-06-01 Thread Roland Winkler
On Mon Jun 1 2015 Barak A. Pearlmutter wrote:
> To put a slightly different perspective on this, I have a sizable
> bbdb file, and sometimes I can't find someone because I'm spelling
> their name wrong. Maybe Steven vs Stephen. The classic way to deal
> with this is to do a SOUNDEX search, or one of its successors.
> 
> A hook here would be useful for this purpose. It wouldn't make
> sense to redefine string-match though. Perhaps there should be a
> standard string-match-loose which is used for
> potentially-approximate matches like this and which has a double
> handful of configuration options and tweaks that can be fiddled
> with by prefixes in the search string.

This is interesting, though it might go in a somewhat different
direction than what the OP had in mind who, I believe, was concerned
that typing Chinese names can be cumbersome so that he wanted an
ascii-based shortcut.

GNU Emacs comes with lisp/soundex.el (for many years).  Yet probably
this does not solve problems with other languages.  It seems to me
that soundex was designed for English only.  Every language has its
own phonetic rules.

The algorithms listed by Wikipedia
http://en.wikipedia.org/wiki/Phonetic_algorithm are all for the
English language, except for one algorithm for German.

There is also http://en.wikipedia.org/wiki/Approximate_string_matching

Again, all this is not specific to BBDB either.  It can probably be
useful for various emacs packages.  But BBDB is probably one of
them.

Any approximate search will give you yet more matches than what you
get otherwise.  So it might not always simplify life if you have a
large BBDB file.  Therefore, exact and approximate search tools
should probably exist in parallel.

--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-05-31 Thread Roland Winkler
On Sun May 31 2015 Feng Shu wrote:
> I just use `pyim-hanzi2pinyin' function, which do such work:
> 
>   "你好 BBDB" -> "nihao BBDB"
> 
> so, what I want to do is like this, for example:
> 1. I have a contact record, which name is "你好 BBDB"
> 2. If use `string-match', I need type "你好" to search this record, which
> need to use Chinese input method and not convenience.

I am still surprised: The purpose of having input methods is to
solve exactly this type of problems!  With a suitable input method
you should be able to type plain ascii

  "nihao BBDB"

which the input method will convert into the text string

  "你好 BBDB"

i.e., the input method should go the opposite direction from what
chinese-pyim appears to do.  And this should work whenever you need
to specify the string "你好 BBDB", be it for searching BBDB, be it
for creating a new record, or be it something completely different
you need to do with emacs.

(Going the opposite direction "nihao BBDB" -> "你好 BBDB" instead of
"你好 BBDB" -> "nihao BBDB" which chinese-pyim seems to do is
certainly much cleaner because emacs will always use the text
strings you really aim for.)

> Another toy example is that you can use "az" to match
> "azzkkkz", at bbdb-search's condition, this is useful.

It's not quite clear to me what the underlying algorithm is.  But
whatever it might be, it seems to be independent of anything
BBDB-specific.  So if the behavior you describe is indeed useful, it
should be implemented in a more generic way than using customizable
variables that affect only rather particular use cases.

> Another approach is auto add "AKA" field with a fuction, the
> problem of this approach is that, many different chinese-char have
> same pinyin, so I need deal with many many conflites when I use
> this approach.

But isn't this likewise a rather general problem with how chinese
characters are handled?

There are already quite many chinese input methods for emacs.  Have
you checked them?  Possibly there is not yet an input method doing
what you have in mind.  But then it might be much better if you
tried to fix that by defining another chinese input method.  It's
not good to cure symptoms if the actual problem appears to lie
elsewhere.

> The above `string-match' only meanful in `bbdb-search', meanless
> in other situation.

???

Roland

--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-05-31 Thread Feng Shu
"Roland Winkler"  writes:

> On Sat May 30 2015 Feng Shu wrote:
>> This patch make `string-match' used by `bbdb-search'
>> customizable. I use this feature to search Chinese contacts names with
>> pinyin. this is a very useful feature for CJK users.
>
> ...I am surprised: what is the purpose of replacing string-match
> with something else?  (The emacs package chinese-pyim that you are
> using seems to be documented in chinese only, which does not help
> me.)
>

I just use `pyim-hanzi2pinyin' function, which do such work:

  "你好 BBDB" -> "nihao BBDB"

so, what I want to do is like this, for example:
1. I have a contact record, which name is "你好 BBDB"
2. If use `string-match', I need type "你好" to search this record, which
need to use Chinese input method and not convenience.
3. if I use this custom, i just type "nihao", then the contact records
will be found. just type ascii.

Another toy example is that you can use "az" to match "azzkkkz",
at bbdb-search's condition, this is useful.

Maybe "string match" is not a good name for this feature.

> I can imagine that CJK might sometimes require different solutions
> than, say, western languages.  Yet I am not sure whether it is the
> right approach to then introduce custom variables like
> bbdb-string-match-function to replace string-match in (only) certain
> instances by something else.
>

Another approach is auto add "AKA" field with a fuction, the problem of
this approach is that, many different chinese-char have same pinyin, so
I need deal with many many conflites when I use this approach.


> I mean: string-match is used by emacs in a zillion of places.  If
> for some reason this built-in function does not do what you need,
> you might want to discuss at emacs-devel whether this can be
> improved in a way that will benefit all emacs code.  Or loading the
> package chinese-pyim could effectively replace string-match.
> (Yet this only works at the lisp level.  There might also be
> instances when string-match is called at the C level.)
>
> Roland

The above `string-match' only meanful in `bbdb-search',  meanless in
other situation.


-- 



--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: [PATCH] bbdb-search: make `string-match' customizable.

2015-05-30 Thread Roland Winkler
On Sat May 30 2015 Feng Shu wrote:
> This patch make `string-match' used by `bbdb-search'
> customizable. I use this feature to search Chinese contacts names with
> pinyin. this is a very useful feature for CJK users.

...I am surprised: what is the purpose of replacing string-match
with something else?  (The emacs package chinese-pyim that you are
using seems to be documented in chinese only, which does not help
me.)

I can imagine that CJK might sometimes require different solutions
than, say, western languages.  Yet I am not sure whether it is the
right approach to then introduce custom variables like
bbdb-string-match-function to replace string-match in (only) certain
instances by something else.

I mean: string-match is used by emacs in a zillion of places.  If
for some reason this built-in function does not do what you need,
you might want to discuss at emacs-devel whether this can be
improved in a way that will benefit all emacs code.  Or loading the
package chinese-pyim could effectively replace string-match.
(Yet this only works at the lisp level.  There might also be
instances when string-match is called at the C level.)

Roland

--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


[PATCH] bbdb-search: make `string-match' customizable.

2015-05-30 Thread ????
Hello:

This patch  make `string-match' used by `bbdb-search'
customizable. I use this feature to search Chinese contacts names with
pinyin. this is a very useful feature for CJK users.

Suggest merge to master, thanks!

0001-bbdb-search-make-string-match-customizable.patch
Description: Binary data
--
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/