Skip to content

[Updates] ADD French, setup file, python3 support#2

Open
jacquesfize wants to merge 4 commits intobermi:masterfrom
jacquesfize:master
Open

[Updates] ADD French, setup file, python3 support#2
jacquesfize wants to merge 4 commits intobermi:masterfrom
jacquesfize:master

Conversation

@jacquesfize
Copy link

Hi Bermi,

Just found your module for pluralizing and singularizing. I needed both French and English support, so I changed your code ;) For the French support, I used the implementation made by @sblondon. Then, I added Python3 support and a setup file. In order to ease the module usage, I also changed the init.py file (see Getting Started section in the README).

The French implementation is a bit rough (not using regexp), so maybe a regexp transformation would be nice ;)

Best Regards,
Jacques.

Fize Jacques added 3 commits July 2, 2018 14:06
 * Finalize Python3 support (remove unicode)
 * Change Readme
 * Add "setup.py"
@sblondon
Copy link

sblondon commented Jul 4, 2018

I think it's nice to have a generic library for several languages. :-)

  • There are tests in pluralizefr so you can refactor it if you want without the fear of regression.
  • There is a bug in the singularize() function:
    if the word parameter does not match a case, the function should return the word (for example the word riz). Currently, the returned value is None.

The current version of pluralizefr library cares only about lowercase. Do you want I modify the code to deal with uppercase?

I will add the singularize() feature to pluralizefr I received as PR: it was a WIP work but I think it's good enough. see sblondon/pluralizefr#1

I can upload the pluralizefr library to pypi.org if you want to use it quickly. Perhaps python-inflector could depends on it if the maintainer doesn't want to include the implementation?

@jacquesfize
Copy link
Author

Sure, you can modify the code (for the uppercase support) ;) As for thesingularize bug, do you want me to modify the code? (and make another pull request ?)

Concerning the upload of pluralizefr to pipy.org, I don't think it's necessary. If pluralizefr was composed of many features, why not? But here, I think that aggregating pluralizefr to your code seems more relevant.

@sblondon
Copy link

sblondon commented Jul 5, 2018

I think there is a mistake: I wrote pluralizefr, not python-inflector. For the integration in python-inflector, you need a reply from bermi.

@isard
Copy link
Collaborator

isard commented Jul 7, 2018

@Jacobe2169 just saw rules/french.py ... wouldn't it be better to use u"" always?

I guess you used u"" if the word has at least one non ASCII character and "" otherwise; but it could be a problem if you mistype a word ("tete", for instance) and someone else corrects it to "tête" instead of u"tête" . :-)

@jacquesfize
Copy link
Author

jacquesfize commented Jul 11, 2018

Sorry about the delay! @sblondon, sure you can integrate singularize() to pluralizefr, I think it's relevant to have both operations!

As for @isard question, in Python3, str variables are Unicode (source here). But, if you're working on python2.7, maybe adding the following import can help :

# Python 2 and 3
from __future__ import unicode_literals    # at top of module

s1 = 'The Zen of Python'
s2 = 'きたないのよりきれいな方がいい\n'

@sblondon
Copy link

@Jacobe2169 finally, I reused the moz4r's pull-request for the implementation of singularize() of pluralizefr. It catches more cases and I added some testcases. There are still some problems (for words finishing by 'aux' in plural which can finsih by 'al' or 'au' in singular).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants