Parker147 / Legends-Viewer

Recreates Dwarf Fortress' Legends Mode from exported files.
GNU General Public License v3.0
62 stars 12 forks source link

Pluralisation should use raws #10

Open HairyDude opened 11 years ago

HairyDude commented 11 years ago

What we have now is two identical functions, LegendsViewer.AppHelpers.MakePopulationPlural() and LegendsViewer.Legends.Formatting.MakePopulationPlural(). These attempt to pluralise nouns based on rules, but in English this doesn't work in general. For example suppose a mod added hippo men with the name "giff", plural "giff"; these functions would produce "gifves". On the other hand there is "mastiff", plural "mastiffs" (Legends Viewer would say "mastifves"), and of course "dwarf", plural "dwarves".

There's also pluralisation of leader titles in LegendsViewer.Controls.EntityPrinter.PrintLeaders() that is even more simplistic, just adding "s" on the end. A mod adding a title "Grand Magus" (plural "Grand Magi") would show up in Legends Viewer as "Grand Maguss".

This unpredictability is why DF raws specify plural forms. If it's at all possible, Legends-Viewer should get plurals from raws instead of trying to figure them out.

Races in vanilla DF that are currently wrong include "princesss", "geeses", "sheeps" and (IMO) "buffalos".

Parker147 commented 11 years ago

This was something that I was never completely happy with and as noted isn't very reliable. I did this because the way the sites and populations export lists site populations. For searching purposes I wanted it to always use the plural form. So in various places sometimes there are multiple plural forms for the same type of population. For the most part it works though.

I chose not to use raws because I didn't want the viewer to rely on additional files. I preferred to just work with the encapsulated data of the exported files as they are easy to move around without relying on the DF installation directory. Also a lot of extra work for something minor.

One of those functions needs to be removed though.

HairyDude commented 11 years ago

Fair enough, though it does mean you can only handle vanilla DF and not mods. (For reference, I'm using vanilla, so it doesn't matter anyway.)

IIRC, the cases I mentioned at the end are all the ones I could find (again in vanilla), so maybe they can be special-cased, which would certainly be quicker and easier than diving into parsing raws. In any case the leader positions should use MakePopulationPlural() (or similar).

Parker147 commented 11 years ago

We could easily set up a dictionary for pluralizing nouns, at least for the vanilla game. If we want to make it correct for mods we could make a dictionary file and then include a tool that could parse raws and add to the file.