Some languages, particularly Slavic languages, change the endings of people's names according to the grammatical context. (For those of you who know grammar or studied languages that do this to words, such as German or Russian, and to help with search keywords, I'm talking about noun declension.)
This is probably easiest with a set of examples (in Polish, to save the whole different-alphabet problem):
- Dorothy saw the cat — Dorota zobaczyła kota
- The cat saw Dorothy — Kot zobaczył Dorotę
- It is Dorothy’s cat — To jest kot Doroty
- I gave the cat to Dorothy — Dałam kota Dorotie
- I went for a walk with Dorothy — Poszłam na spacer z Dorotą
- “Hello, Dorothy!” — “Witam, Doroto!”
Now, if, in these examples, the name here were to be user-entered, that introduces a world of grammar nightmares. Importantly, if I went for Katie (Kasia), the examples are not directly comparable — 3 and 4 are both Kasi, rather than *Kasy and *Kasie — and male names will be wholly different again.
I'm guessing someone has dealt with this situation before, but my Google-fu appears to be weak today. I can find a lot of links about natural-language processing, but I don'think that's quite what I want. To be clear: I'm only ever gonna have one user开发者_JS百科-entered name per user and I'm gonna need to decline them into known configurations — I'll have a localised text that will have placeholders something like {name nominative}
and {name dative}
, for the sake of argument. I really don't want to have to do lexical analysis of text to work stuff out, I'll only ever need to decline that one user-entered name.
Anyone have any recommendations on how to do this, or do I need to start calling round localisation agencies ;o)
Further reading (all on Wikipedia) for the interested:
- Declension
- Grammatical case
- Declension in Polish
- Declension in Russian
- Declension in Czech nouns and pronouns
Disclaimer: I know this happens in many other languages; highlighting Slavic languages is merely because I have a project that is going to be localised into some Slavic languages.
Seems to me like you want a morphology-engine for polish. In very short they can do both analysis and generation from surface-form (what we read and write) to some abstract form, like "Dorothy + FEM + DAT", taking both declensions and phonology into account.
Take a look here (im not polish but it looks good, and most imporantly it has downloads :) ) http://nlp.ipipan.waw.pl/~wolinski/morfeusz/
Here are some introductory on the subject.
in German the only thing that is modified is article: Der, Die, Das. And names don't have them. So nothing fancy about German. (btw it is not Slavic)
about russian (my native). this whole concept of changing ending is painful for processing, but (!) if you have only person's names and you have hints like {name nominative} it is relatively easy. Majority of female names have common structure: root + a/ya (а/я), and each hint will give you definite rool how to change the ending. I see that in Polish it is same: Dorot|a, Dorot|ę. Male names are also simple. They either follow exactly same rules (if end with a/ya (а/я)) or if they end with j/y (like my name Andrey) the mapping is slightly different.
精彩评论