Module franko

Classes

Franko()

A simple interface for Ukrainian name declension using shevchenko.js.

class Franko.franko.Franko[source]

A simple interface for Ukrainian name declension using shevchenko.js. Locates Node.js and the bundled JS script on initialization, and provides a generate method to decline names for different inputs.

generate(txt, gender='masculine')[source]

Decline the given Ukrainian full name in all grammatical cases.

Parameters:
  • txt (str) – A string in the format “<surname> <given> <patronymic>”. Use “-” to skip a part (e.g. “- Ivan Petrovych”).

  • gender (str) – Either “masculine” or “feminine”.

Returns:

‘nominative’, ‘genitive’, ‘dative’, ‘accusative’, ‘instrumental’, ‘locative’, ‘vocative’, mapping to the declined full name.

Return type:

A dictionary with keys

Raises:
  • ValueError – If gender is invalid or txt is empty.

  • RuntimeError – If Node.js execution fails.

  • FileNotFoundError – If the JS bundle is missing.