User Tools

Site Tools


namegenerator.xsd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

namegenerator.xsd [2012/09/26 14:38]
irian created
namegenerator.xsd [2012/09/27 11:17] (current)
irian Completed Description
Line 27: Line 27:
  
 ===== Origin ===== ===== Origin =====
-In the first part, there are these "Origin" elements, which simply define lists of names. In the example, we have an Origin "Germany" and in this origin, three "Category"s (Female Firstnames, Male Firstnames and Surnames). The actual names are in the "Names" element, separated by commas.+In the first part, there are these "Origin" elements, which simply define lists of names. In the example, we have an Origin "Germany" and in this origin, three "Category"s (Female Firstnames, Male Firstnames and Surnames). The actual names are in the "Names" element, separated by commas. You can name your Origins and Categories whatever you want.
  
 ===== NameDefinition ===== ===== NameDefinition =====
Line 40: Line 40:
  
 <code> <code>
- <NameDefinition name="German Female"> + <NameDefinition name="German Male"> 
- <FixedNamePart>Frau</FixedNamePart> + <FixedNamePart>Herr</FixedNamePart> 
- <NameRef Origin="Germany" Category="Female Firstnames"/>  + <NameRef Origin="Germany" Category="Male Firstnames"/>  
- <NameRef Origin=&quot;Germany&quot; Category="Surnames";/> + <FixedNamePart&gt;Johnson&lt;/FixedNamePart>
  </NameDefinition>  </NameDefinition>
 </code> </code>
  
-In this example, "Frau" (meaning Mrs.) will be added in front of any German Female name. +In this example, "Herr" (meaning Mr.) will be the first thing, then a random german male first name and then "Johnson"
  
-In some cases, you also might want to control where to put spaces yourselves, for example when creating double-names. In this case, simple set the automaticSpaces attribute of the NameDefinition like this:+In some cases, you also might want to control where to put spaces yourselves, for example when creating double-names. In this case, simple set the automaticSpaces attribute of the NameDefinition to false, like this:
  
 <code> <code>
Line 62: Line 62:
 </code> </code>
  
-By setting automaticSpaces="false" you tell the program that you will handle the spaces yourself (otherwise, the program simply adds a space after each element). So, in the example you have to add the spaces after "Frau" and all the name parts manually, but you gain the ability to create double name with a dash, for example "Bergen-Eichel". +By setting automaticSpaces="false" you tell the program that you will handle the spaces yourself (otherwise, the program simply adds a space after each element). So, in the example you have to add the spaces after "Frau" and all the name parts manually (with FixedNamePart elements), but you gain the ability to create double name with a dash, for example "Bergen-Eichel", without having the program adding spaces to it (as this would lead to "Bergen - Eichel".  
 + 
 +==== PercentChance ==== 
 +In some cases you want only a certain percent of people have a certain part of the name. For example, let's say we want 10% of our men have a 2nd name. Then you would write... 
 + 
 + 
 +<code> 
 + <NameDefinition name="German Male"> 
 + <NameRef Origin="Germany" Category="Male Firstnames"/>  
 + <NameRef Origin="Germany" Category="Male Firstnames" percentChance="10"/>  
 + <NameRef Origin="Germany" Category="Surnames"/> 
 + </NameDefinition> 
 +</code> 
 + 
 +And bingo, only in 10% of the cases, a 2nd first name will be added.  
 + 
 +==== Combination ==== 
 +Imagine the example about the double-names. Now imagine, you only want to have 10% of the people to have double names. As the double name is attached by a slash, you will have to combine that somehow: Only add a slash if there's a double name. For this, you can use Combinations: 
 + 
 +<code> 
 + <NameDefinition name="German Female" automaticSpaces="false"> 
 + <FixedNamePart>Frau </FixedNamePart> 
 + <NameRef Origin="Germany" Category="Female Firstnames"/>  
 + <FixedNamePart> </FixedNamePart> 
 + <NameRef Origin="Germany" Category="Surnames"/> 
 + <Combination percentChance="10"> 
 + <FixedNamePart>-</FixedNamePart> 
 + <NameRef Origin="Germany" Category="Surnames"/> 
 + </Combination> 
 + </NameDefinition> 
 +</code> 
 + 
 +As you can see, this combination will only appear in 10% of all cases and when it does, it consists of one slash and a surname.  
 + 
 +==== Choice ==== 
 +Sometimes you want not a combination of things, but one of a list of things. For this, there is the choice element. For example, we know that american people can have various names: English-sounding ones, german-sounding ones, etc. So when we want to create an american name, we have to choose one. Have a look at the following example (and imagine, that the apropriate Origins and Categories were there): 
 + 
 +<code> 
 + <NameDefinition name="American Male"> 
 + <Choice> 
 + <NameRef Origin="German" Category="Male Firstnames" percentChance="10"/> 
 + <NameRef Origin="Finland" Category="Male Firstnames" percentChance="10"/> 
 + <NameRef Origin="England" Category="Male Firstnames"/> 
 + </Choice>  
 + <Choice> 
 + <NameRef Origin="German" Category="Male Surnames" percentChance="10"/> 
 + <NameRef Origin="Finland" Category="Male Surnames" percentChance="10"/> 
 + <NameRef Origin="England" Category="Male Surnames"/> 
 + </Choice> 
 + </NameDefinition>  
 +</code> 
 + 
 +This example gives the name a 10% chance, that the firstname is german. If this doesn't apply, then there's a 10% chance that the name will be a finish one. And if that doesn't apply, it'll take an english one. Same thing with the surnames. The important point it to not give a percentChance for the last choice (or at least a 100% one), as otherwise you could end up with no name at all. 
 + 
 +As you can see, the name generator files are quite powerfull and should be totally adequate to create not only European names, but also Asian, African and even fantasy names.
namegenerator.xsd.txt · Last modified: 2012/09/27 11:17 by irian