1

This problem might not occure in English, but does really hurt in Polish language. I guess that my question is mostly for Polish users since they might already have a decent solution.

What I mean, is that the verbs in Polish language, are different for male and female in past time. And there are dozens of different options. If my script need to display lots and lots of text - it really becomes a painful problem to deal with. Short example (not very elegant use of language, but for demonstration purpose):

Male: On poszedł i nie znalazł, więc klasnął w dłonie i nagle go coś pożarło.

Female: Ona poszła i nie znalazła, więc klasnęła w dłonie i nagle ją coś pożarło.

I managed to find such an solution: each time at the beginning of script, I prepare variable that looks like that: $verb[$ending][$sex] = 'something';

//$ending does contain - for my convenience - letters that says what kind of eding am I changing, instead of numeric options
//Examples:
$verb['-a']['male'] = '';
$verb['-a']['female'] = 'a';
//works for On=>Ona, znalazł=>znalazła

$verb['al-ela']['male'] = 'ął';
$verb['al-ela']['female'] = 'ęła';
//works for klasnął=>klasnęła

Now if I add fact, that 99% of time I don't know from the beginning what kind of sex am I dealing with, my variable start look kinda scary: $verb['al-ela'][$_SESSION['user'.$id]['sex']]. So my end text does look like that:

O'.$verb['-a'][$_SESSION['user'.$id]['sex']].' posz'.$verb['edl-la'][$_SESSION['user'.$id]['sex']].' i nie znalazł'.$verb['-a'][$_SESSION['user'.$id]['sex']].', więc klasn'.$verb['al-ela'][$_SESSION['user'.$id]['sex']].' w dłonie i nagle '.$verb['go-ja'][$_SESSION['user'.$id]['sex']].' coś pożarło.

Yes, sure - this is rather extreme example, but sometimes text really does look like that and it is unavoidable.

To make long story short, here are my questions:

  1. Am I doing it wrong? Is there a better/faster/more handy solution for such type of problems?
  2. Is there a script that might detect/change endings for me without ruining rest of the text?
  3. I struggled to find full list of possible ending variations in Polish (for both singular, and plural), so I'm creating my own list as I'm finding new options. Perhaps someone does have a list like that => it might help me to create script from my 2nd question.

Thanks a lot in advance, best regards!

Community
  • 1
  • 1
Zorann
  • 335
  • 2
  • 16
  • Hi - I would maybe define a function that has two parameters ($text, $gender) where you pass in the text you need to be 'gendered' and the session 'gender'. In that function, you could break down the text into an array of words, and loop through it to find the verbs that need to be 'gendered' and apply it there. You could eventually even make this into a package for other users, as I'm sure you're not the only one who would need to use this! – party-ring Oct 23 '18 at 09:06
  • Hi. Thanks for Your suggestion. It would lead to make a script from my 2nd. question, that could solve my problem. But it's not that simple. Finding verbs from whole vacabulary is kinda out of my reach (and server capability ;) ). – Zorann Oct 23 '18 at 10:07

0 Answers0