Bit fiddly to explain but I used these weightings to score dwarves for military, civ, performer, academic and medic roles.
For military I rated balanced temperaments preferring not to train up hateful, quarrelsome dwarves so much and keep them crafting instead.
kicks in if the trait value is very high or low.
const int traitscore[] ={
//mil civ pfm aca med
//hi lin lw
-1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0//LOVE_PROPENS
,-2,-1,-2, -1,-1, 0, 0,-2, 0, 0,-2, 0, -2,-2, 0//HATE_PROPENS
,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0//ENVY_PROPENS
, 0, 1,-1, 0, 0, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0//CHEER_PROPEN
,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0//DEPRESSION_P
,-1, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0//ANGER_PROPEN
,-1,-2, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0//ANXIETY_PROP
, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0//LUST_PROPENS
, 0,-2, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0//STRESS_VULNE
,-1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0//GREED
, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, -1, 0,-1//IMMODERATION
,-2, 2,-2, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1,-1, 1//VIOLENT
, 0, 2,-1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1,-1//PERSEVERENCE
, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 1, 0, -1, 0,-1//WASTEFULNESS
, 0, 0,-1, 0, 1, 0, 0, 1, 0, 0, 1, 0, -1, 1, 0//DISCORD
, 0, 1, 0, 0,-1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0//FRIENDLINESS
,-1, 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-1, 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, 2,-1//TOLERANT
,-1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0//EMOTION OBSES_
,-2, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, -2, 0, 0//SWAYED_BY_EM
,-1, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2,-1//ALTRUISM
, 1, 2,-2, 0, 1, 0, 0,-1, 0, 0,-1, 0, 0, 0, 0//DUTIFULNESS
,-1, 0,-1, 1, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0//THOUGHTLESSN
,-1, 1, 0, 0, 2,-1, 0,-1, 0, 0, 1, 0, 0, 1, 0//ORDERLINESS
,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0//TRUST
, 0, 1, 0, 0,-2, 1, 0, 3,-1, -1, 1, 1, 0, 1,-1//GREGARIOUSNE
, 1, 1, 0, 0,-1, 1, 0, 0, 0, 0, 0, 1, -1, 1, 0//ASSERTIVENES
, 0, 2, 0, 2, 3,-1, 0, 0, 0, 0, 0, 0, 0, 1,-1//ACTIVITY_LEV
, 1, 1, 0, -1,-3, 2, 0, 0, 0, -1,-1, 0, 0, 0, 0//EXCITEMENT_S
,-1, 0, 1, 0, 0, 0, 0, 4, 0, 2, 2,-1, -1, 0, 0//IMAGINATION
, 0,-1, 0, -1,-1, 0, 0, 1, 0, 2, 2,-1, -1, 0, 0//ABSTRACT_INC
,-1, 0, 1, 1, 1, 0, 1, 1,-1, 0, 1, 0, 0, 0, 0//ART_INCLINED
};
const int regardscore[] ={
//mil civ pfm aca med
2,-1,-1, 0, 0 //"Law"
, 2, 0, 1, 0, 0 //"Loyal"
,-1, 1, 1, 0, 0 //"Family"
, 1, 0, 0, 1, 1 //"Friendship"
, 0, 0, 0, 1, 0 //"Power"
, 0, 0, 0, 1, 0 //"Truth"
, 0, 0, 0, 0, 0 //"Cunning"
, 0, 0, 1, 1, 0 //"Eloquence"
, 1, 0, 1, 0, 1 //"Equity"
, 0, 0, 0, 0, 1 //"Decorum"
, 0, 0, 0, 0, 0 //"Tradition"
, 0, 1, 0, 1, 0 //"Art"
, 1, 0, 1, 0, 0 //"Accord"
,-2, 1, 1, 2, 0 //"Freedom"
, 1, 0,-1, 0, 0 //"Stoicism"
,-1, 0, 1, 2, 0 //"SelfExam"
, 1, 0, 1, 0, 1 //"SelfCtrl"
,-2, 1,-1, 2, 0 //"Quiet"
, 1, 0, 1, 0, 1 //"Harmony"
, 1, 0, 1, 0, 0 //"Mirth"
,-1, 3,-2,-1,-1 //"Craftwork"
, 3,-2,-2, 0,-1 //"Combat"
, 2, 1, 0,-1, 0 //"Skill"
, 1, 3,-1,-1, 1 //"Labour"
, 2, 0, 0,-1, 1 //"Sacrifice"
, 2, 0, 0, 0,-1 //"Rivalry"
, 2, 0, 0, 0, 1 //"Grit"
,-1,-2, 1, 0,-1 //"Leisure"
, 0, 1, 1, 1, 0 //"Commerce"
, 0, 1, 1, 1, 0 //"Romance"
,-1, 1, 0, 1, 1 //"Nature"
,-1, 1, 1, 0, 1 //"Peace"
,-1,-1,-1, 4, 1 //"Lore"
};
const int dreamscore[] ={
//mil, civ, pfm, aca, med
10,10,10,10,10 // "Surviving"
,10,10,11,11,10 // "Status"
, 9,10,10,10,10 // "Family"
,11,10,11,11,10 // "Power"
, 9,12,10,10,10 // "Artwork"
, 9,12, 8, 9, 9 // "Craftwork"
,10,10,10,11,10 // "Peace"
,12,10, 9, 9,10 // "Combat"
,11,11,10, 9,11 // "Skill"
,10,11,11,10,10 // "Romance"
,12,10,10,11,10 // "Voyages"
, 7, 8, 8, 9, 8 // "Immortality"
};