First Last Prev Next    No search results available
Details
: %from([first|last]name)% should reformat "Lastname, First...
Bug#: 25083
: smarttemplate4
: General
Status: RESOLVED
Resolution: FIXED
: PC
: Windows 7
: unspecified
: P2
: enhancement
: ---

:
:
:
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Shawn Lipscomb <Shawn.Lipscomb@EWRInc.com>
Assigned To: Axel Grude <axel.grude@gmail.com>
:

Attachments
0.9.3 prerelease 108 (320.33 KB, application/x-xpinstall)
2013-04-13 05:41, Axel Grude
no flags Details
0.9.3 prerelease 156 (327.40 KB, application/x-xpinstall)
2013-06-05 07:55, Axel Grude
no flags Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2012-08-16 11:19
A lot of emails I get are from a sender where the From line says something
like:

"Doe, John - USDA" <john.doe@USDA.gov>

When I use %from(firstname)%, it picks out "Doe".  Please teach it that if
there is a comma in the friendly name, that the text before the comma is the
lastname and the text after the comma is the firstname.  Thanks.
------- Comment #1 From Roman 2013-04-10 20:48:45 -------
I experience the same problem.
Please add "%from(lastname)%" variable.
------- Comment #2 From Roman 2013-04-10 20:59:27 -------
our emails is like "Levi, Alexandr <alevin@sssssssssss.org>"
so if be able at least parse firstname and lastname - that will solve most of
problems.

Or create variable that normalize name from "Levi, Alexandr" to "Levi Alexandr"
it would also help, because "Hello, Levin, Alexandr" look weird.
------- Comment #3 From Axel Grude 2013-04-11 03:49:04 -------
Sounds simple enough. can you send me a test email to my mail account that uses
this address format? Just put

[SmartTemplate4] - Bug 25083

into the subject line please.

thanks
  Axel
------- Comment #4 From Axel Grude 2013-04-11 03:58:15 -------
I assume that the requirement is as follows: if the names before the email
address includes a comma, use the following rule

A, B => B A

personally I prefer the first name to come first myself, so that sounds like a
reasonable request.

examples
1) Doe, John => John Doe
2) Smith, Mrs. Jane => Mrs. Jane Smith
3) Acme Corporation, Ltd. =>  Ltd. Acme Corporation
4) Mr Brown, Alex => Alex Mr Brown
5) Elizabeth Taylor, Hollywood Corp => Hollywood Corp Elizabeth Taylor
6) Topley-Bird, Martina Eva => Eva Martina Topley-Bird

Of course it is not possible to make a distinction between cases 1, 2 and 3, as
a real intelligence that distinguishes names from other entities would be out
of scope. It would always assume everything before the comma to be last name
and everything after the comma as first name.

Also, how should it behave if there is more than one comma?
------- Comment #5 From Axel Grude 2013-04-13 03:59:15 -------
(In reply to comment #4)
> I assume that the requirement is as follows: if the names before the email
> address includes a comma, use the following rule
> 
> A, B => B A
> 
> personally I prefer the first name to come first myself, so that sounds like a
> reasonable request.
> 
> examples
> 1) Doe, John => John Doe
> 2) Smith, Mrs. Jane => Mrs. Jane Smith
> 3) Acme Corporation, Ltd. =>  Ltd. Acme Corporation
> 4) Mr Brown, Alex => Alex Mr Brown
> 5) Elizabeth Taylor, Hollywood Corp => Hollywood Corp Elizabeth Taylor
> 6) Topley-Bird, Martina Eva => Eva Martina Topley-Bird
> 
Ok, here is another apparently common case: Outlook will often place a calling
name in parentheses,e.g.

Grude, Axel (Alex) <address@domain.com>

in this case, it appears to be the wish of the sender to be addressed as
'Alex'. Parsing the (suggested) name between the parentheses seems to be quite
a clever additional rule for this case.

Shouldn't this override all firstname, lastname and name rules?

Or just override in the cases of firstname and name?
------- Comment #6 From Axel Grude 2013-04-13 04:37:14 -------
I think this swapping algorithm should apply to from(name), from(lastname) and
from(firstname). 

Also I will implement the bracketed expression to be used in the case of (name)
and (firstname). I will probably add another global option to control this
separately.
------- Comment #7 From Axel Grude 2013-04-13 04:43:25 -------
(In reply to comment #0)
> A lot of emails I get are from a sender where the From line says something
> like:
> 
> "Doe, John - USDA" <john.doe@USDA.gov>
> 
> When I use %from(firstname)%, it picks out "Doe".  Please teach it that if
> there is a comma in the friendly name, that the text before the comma is the
> lastname and the text after the comma is the firstname.  Thanks.
> 

totally oversaw your test case! what about from(firstname) or from(name) in
this case?


from(firstname) would generate
John - USDA

from(name) would generate
John - USDA Doe

you cannot possibly expect the algorithm to detect the fact that - USDA is not
part of the names (please note there are composite firstnames, such as
John-Patrick, so we cannot just truncate after an unexpected character). This
will get very messy soon. 

It would work however with:
Doe, Johann-Sebastian
Topley-Bird, Christina - Maria

but not so nicely with
Gates, Bill - Microsoft
------- Comment #8 From Axel Grude 2013-04-13 05:41:58 -------
Created an attachment (id=7562) [details]
0.9.3 prerelease 108

Here is an early implementation of what you suggested. The new behavior can be
disabled by unchecking the option in st4 settings > advanced > global settings

[x] Correct LastName, FirstName

An added (name) expression will override in the case of firstname and name.
In all other (name) cases, the rule 

A, B => B A

is applied. It was a couple of hours of work, but might be worth it.
------- Comment #9 From Roman 2013-04-13 08:09:58 -------
Thanks a lot.
works pretty well so far, I will keep you posted if smth strange happen.

Answer to "Comment #7" (just idea):
Name recognition is out of scope definitely and we will never succeed in this.
But for people with long names are ok to call them by first part only in most
cases. First part is all characters before any non alphabet symbol.

> "Doe, John - USDA" <john.doe@USDA.gov>

from(firstname_short) would generate
John

from(name_short) would generate
John Doe
------- Comment #10 From Axel Grude 2013-06-05 07:55:03 -------
Created an attachment (id=7598) [details]
0.9.3 prerelease 156

Latest prerelease. No changes as far as last, first functionality is concerned,
but it has the ability to take an expression in parens as name, example

john Doe (Joe) jd@xyz.com

%to(name)% => Joe

this is a typical corporate outlook format and is designed to use the Name in
parentheses to address people.

Also, %to(mail)% now supresses the automatic linkification; for a linked email,
use %to(mail,link)%

First Last Prev Next    No search results available