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

Can't observe support for mixed modes #76

Open
ervinoro opened this issue May 5, 2020 · 5 comments
Open

Can't observe support for mixed modes #76

ervinoro opened this issue May 5, 2020 · 5 comments

Comments

@ervinoro
Copy link

ervinoro commented May 5, 2020

According to the feature comparison table, segno is supposed to support mixing modes, and documentation further specifies that qr.mode is supposed to return None if mixed modes are used. However, I am unable to find any documented API for manually specifying the segmentation, and I can not observe any automatic segmentation either.

>>> qr = segno.make('THE SQUARE ROOT OF 2 IS 1.41421356237309504880168872420969807856967187537694807317667973799')
>>> qr.mode
'alphanumeric'
>>> qr.designator
'4-L'

Optimal solution would be version 3, with two segments: alphanumeric and numeric.

@heuer
Copy link
Owner

heuer commented May 6, 2020

Thanks for bringing up this issue.
Segno supports multiple modes but does optimize the input yet.

>>> qr = segno.make(['THE SQUARE ROOT OF 2 IS 1', '.', '41421356237309504880168872420969807856967187537694807317667973799'])
>>> qr.mode
>>> qr.designator
'3-L'

Result:

three-segments

>>> qr = segno.make(['THE SQUARE ROOT OF 2 IS 1.', '41421356237309504880168872420969807856967187537694807317667973799'])
>>> qr.mode
>>> qr.designator
'3-L'

Result:
two-segments

I agree that Segno should recognize the modes and divide the content accordingly, see also #25.

@ervinoro
Copy link
Author

ervinoro commented May 6, 2020

Ah, thanks, that is fair enough. In that case I would redirect this issue to be against incomplete documentation. It would be helpful if it would be mentioned there that manual segmentation is supported by passing an iterable as content, in addition to the listed str, int and bytes.

https://segno.readthedocs.io/en/stable/api.html#segno.make.params.content

@neycyanshi
Copy link
Contributor

@heuer , currently users can not pass mode in str type for different segments. For example, this is invalid input

>>> qr=segno.make([('abcabcabc', 'byte'), ('123123123', 'numeric')])

I have to write

>>> qr=segno.make([('abcabcabc', 4), ('123123123', 1)])

@heuer
Copy link
Owner

heuer commented Mar 15, 2021

@neycyanshi, sorry for the late response.
You're right. The idea was that the user provides an iterable of chunks and Segno detects the "type" of the chunk automatically. I am not happy with the current solution, though. IMO it would be much better if the user provides the content "as it is" and Segno divides the content into optimal chunks, see #25

@neycyanshi
Copy link
Contributor

Yes, it is better to optimize chunks. Are you working on it? I'd like to help if you are busy now.

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

No branches or pull requests

3 participants