Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved __repr__/__str__ for Analyzer/Generator/Translator #25

Open
sushain97 opened this issue Jun 27, 2018 · 4 comments
Open

Improved __repr__/__str__ for Analyzer/Generator/Translator #25

sushain97 opened this issue Jun 27, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@sushain97
Copy link
Member

I'm not sure what they are now but they're probably not too helpful

@sushain97 sushain97 added the enhancement New feature or request label Jun 27, 2018
@orgh0
Copy link
Collaborator

orgh0 commented Jun 30, 2018

@sushain97

In [1]: import apertium

In [2]: a = apertium.Analyzer('en')

In [3]: a
Out[3]: Analyzer(mode=eng-morph, lang=eng)

Is the structure okay ?

@sushain97
Copy link
Member Author

Ideally, __repr__ would recreate the class. So, repr(a) == "Analyzer(lang='eng')" and str(a) == "<Analyzer: eng-morph>" seems nice.

@orgh0
Copy link
Collaborator

orgh0 commented Jun 30, 2018

@sushain97 what about for the Translator module?
I don't have mode there.
we just parse mode files in that module.
What should the __str__() have?

@sushain97
Copy link
Member Author

There is a mode. It's something like spa-cat_valencia. The fact that we're parsing a mode implies there is one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants