* Name capitalisation and parts check

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Name capitalisation and parts check

Post by jelv »

This is a repost of a plugin I was working on last summer with the download now on OneDrive in accordance with Changes to the arrangements for making plugins available in the forums

The plugin checks the capitalisation of names and that name pieces match the full name. It reports:
  • where any part of name is not first letter capital and remainder lower case.
  • where any part of the name does not match it's corresponding piece
Rules for irregularly capitalised names such MacDonald can be added, as well as
individual exceptions. There are separate rules for each name part.

The comparison of the name parts with the full name is principally for users who have imported their data from a source where the name parts are used and may have made subsequent changes to full names in FH (FH does not update the name pieces when the full name is changed).

The latest version can be downloaded from here: Name capitalisation and parts check
 
There is one significant limitation: Currently it may give error messages or not find issues if there are names which use non-Latin characters, however as it is a report only it is still safe to use the plugin. I have to learn how to use UTF8 so these should be handled correctly in a later version (there are a lot of string functions used within the plugin so this will take some time).

This is the main configuration screen:
Name checking - configuration.png
Name checking - configuration.png (8.07 KiB) Viewed 900 times
 
The rules and exceptions define the names which are not initial letter capital, remaining letters lower case. Selecting any of the options opens this dialog:
Name checking - Rules and Exceptions.png
Name checking - Rules and Exceptions.png (7.03 KiB) Viewed 900 times
 
To add entries enter the rule/exception in the box at the top right and click Add.

To change an entry select it from the list on the left which will copy it to the box at the top right. Make the required change and click Update.

To remove an entry select it from the list on the left and click Delete.

Given & Surname Rules

The rules define the beginnings of names (in the correct capitalisation) where the rest of the name begins with an upper case letter and the remainder lower case. Examples:
  • Mac     MacLeod, MacDonald etc.
  • O'        O’Gara
  • d'         d’Orsay
Prefix, Given Name, Surname Prefix and Surname Exceptions

The exceptions are specific name parts which do not follow the default capitalisation or are incorrectly capitalised by one of the rules. For example, the Mac rule would expect MacHin or MacE so Machin and Mace could be added to the Exceptions list to correct this. Note that if you have names where the same spelling can be capitalised differently (e.g. Macdonald or MacDonald) both versions should be added the the Exceptions list.

The Prefix Exceptions list can be used for abbreviated titles which are irregularly capitalised, for example Staff Sergeant is abbreviated as SSgt.

The Surname Prefixes are a special case. They will act as described above, but can also be used to automatically find surname prefixes which are at the beginning of the surname or the end of the given name. When either/both these checks are turned on in the options, it will identify all the surname prefixes in the exceptions/list so all the prefixes in the project should be added to the list. Note that if the capitalisation varies, all variants will need to be in the list (e.g. Vincent Van Gogh and Simon “Piet” van der Valk would require both Van and van to be in the list).

Options

The options dialog allows enabling/disabling some additional checks:
  • Ancestry Synchronisation plugin compatability. This checks for issues which would would cause incorrect results when using Mark Draper's plugin.
  • Given name used must be part of given name.
  • Look for surname prefixes in surname. See notes above.
  • Look for surname prefixes in given name. See notes above.
Further options to enable/disable other checks may be added as a result of user feedback.

If you find any issues please go to Utilities, Diagnostic report and select up to five individuals that are of concern. This generates a text report that can be copied (use the Copy to clipboard button) and pasted in to a post or private message.

Finally, I'd like to acknowledge the testing and advice given to me by Mark Draper as I learnt more about LUA programming and specifically the idiosyncrasies of IUP dialogues.
John Elvin
User avatar
johnhanson
Diamond
Posts: 80
Joined: 27 Nov 2002 16:50
Family Historian: V7
Contact:

Re: Name capitalisation and parts check

Post by johnhanson »

I am running version 0.2.3 which appears to be the latest

Selected the check option and after a few second it gave the following error

Image

With no indication as to where it is likely to be I can't correct the problem
Attachments
image.png
image.png (6.84 KiB) Viewed 431 times
John Hanson FSG
Researcher, the Halsted Trust
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Name capitalisation and parts check

Post by jelv »

That has got me totally bamboozled. It's trying to extract the part of the full name between the slashes. I've tried various things to get the same error without success.

Could you try the version linked below please. It will still error but just before I hope it will pop up a message giving the record number and full name of the individual giving the error.

If the issue isn't obvious, could you use the Utilities, Diagnostic Report for the individual and send me the output please.

Name capitalisation and parts check (0.2.3a).fh_lua
John Elvin
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Name capitalisation and parts check

Post by jelv »

Mike Tate has identified here that this error could occur if a name suffix contains a slash.

Is there a valid reason for having this?
John Elvin
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Name capitalisation and parts check

Post by jelv »

I have completed an analysis of the issue. It happens if either the name prefix, or the surname suffix contains a slash and the complete surname such that after removal of the prefix/suffix there is no surname left.

My inclination is to report an error if either contains a slash.
John Elvin
User avatar
johnhanson
Diamond
Posts: 80
Joined: 27 Nov 2002 16:50
Family Historian: V7
Contact:

Re: Name capitalisation and parts check

Post by johnhanson »

John

No Mike's idea is not the error that I can see
FHUG-001.jpg
FHUG-001.jpg (13.78 KiB) Viewed 324 times
This is the person that it errored on

Her name entry is
FHUG-002.jpg
FHUG-002.jpg (88.13 KiB) Viewed 324 times
From the diagnostic report
Name capitalisation and parts check - Diagnostic Report Mon 22 Apr 2024 18:41

@I39171@ NAME[1] Ella Loretta /POLLARD/
@I39171@ NAME[1].NSFX POLLARD/
---------------------------------------------------------------------------------
@I39171@ NAME[2] Ellen Pollard //
@I39171@ NAME[2].NOTE2 shown as "Ellen" in much of Barbara Reidy O'Neill's genealogical records, but named as "Ella" in her father's obituary and most of the Halstead family records.
@I39171@ NAME[2].SOUR
---------------------------------------------------------------------------------
@I39171@ NAME[3] "Nell" //
@I39171@ NAME[3].NOTE2 nicknamed "Nell" by Jake Moore
@I39171@ NAME[3].SOUR
=================================================================================
AncestrySync=N
AutoSpfxInGiven=N
AutoSpfxInSurn=Y
GivenExceptions=
GivenRules=Mac,Mc,O'
NameUsedInGiven=Y
PrefixExceptions=SSgt
SurnameExceptions=Mace,Machin,Macmillan
SurnameRules=de',Mac,Mc,O'
SurPrefExceptions=von
=================================================================================

If you need any more let me know

Bear in mind that this is a large database with over 41,000 people in it
John Hanson FSG
Researcher, the Halsted Trust
User avatar
tatewise
Megastar
Posts: 28498
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Name capitalisation and parts check

Post by tatewise »

Yes, that is the same cause for the error.
The NSFX = POLLARD/ which is the trailing part of the NAME field and includes the slash /
So when the 'suffix' POLLARD/ is removed from Ella Loretta /POLLARD/ it leaves Ella Loretta / which does not contain two slashes and that causes the fault.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28498
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Name capitalisation and parts check

Post by tatewise »

The 'safe' plugin script solution is to cater for every :match(...) operation possibly returning nil.
Don't assume that such a match will always be successful, i.e. use defensive programming techniques.

Similar techniques should be applied to all other operations to avoid unexpected failures.

In this specific case for line 1048 the following will avoid the error message but may not extract the surname:
strSurname = strWorkname:match('%b//') or strWorkname
strSurname = strSurname:gsub('/','')
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Name capitalisation and parts check

Post by jelv »

Please try version 0.2.4 which detects and reports name prefixes and suffixes which contain the slash character.

Name capitalisation and parts check (0.2.4)
John Elvin
User avatar
johnhanson
Diamond
Posts: 80
Joined: 27 Nov 2002 16:50
Family Historian: V7
Contact:

Re: Name capitalisation and parts check

Post by johnhanson »

John
That version works fine

However, it is reporting all my surnames (This project and all of mine are old school where the surnames are all in capitals) so to me there are all OK - I would rather see the ones that aren't in capitals

Now, that would be a nice feature enhancement

I can live with that though

Now to do some sorting out!
John Hanson FSG
Researcher, the Halsted Trust
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: Name capitalisation and parts check

Post by jelv »

The normal way to enter names in FH is in their proper case, by default FH will capitalise the surnames wherever they appear, but it does mean that you have the option of having them in their proper case if needed.

From Family Historian Help:
https://www.family-historian.co.uk/help/fh7/hh_start.htm#welcometofamilyhistorian.html wrote:
  • We recommend that you do not enter the surname in upper case. It will, by default, be displayed in upper case in diagrams, reports and elsewhere anyway; but you should enter it (and all other parts of the name) in mixed case as it would normally be written. For example, the surname McCracken should be entered as shown.
If you did decide to change to the normal way there is a plugin written by Jane Taubman which will convert all the existing surnames to lower case: Clean up Surname Capitalisation V1.3 Then use my plugin to see if there exceptions that need dealing with.

You could copy your project and try that out to see how you get on with the normal method.
John Elvin
User avatar
johnhanson
Diamond
Posts: 80
Joined: 27 Nov 2002 16:50
Family Historian: V7
Contact:

Re: Name capitalisation and parts check

Post by johnhanson »

John
Thanks for the information but having been doing it instinctively for 45 years I can't see it being an easy change for me

I will have to give it some thought and with the big database also have a chat with the trustees of the charity it is connected to
John Hanson FSG
Researcher, the Halsted Trust
Post Reply