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

Moving complex segmenter logic into complex module #3349

Merged
merged 5 commits into from
Apr 20, 2023

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Apr 19, 2023

Based on #3348

Makes it clearer where the modules are used, and makes a whole lot of types more private.

@robertbastian robertbastian added the C-segmentation Component: Segmentation label Apr 20, 2023
@robertbastian robertbastian requested review from Manishearth and removed request for aethanyc and makotokato April 20, 2023 15:21
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just moving things around. Seems fine

dict: &'l UCharDictionaryBreakDataV1<'l>,
grapheme: &'l RuleBreakDataV1<'l>,
}

impl<'l> DictionarySegmenter<'l> {
pub fn new(
pub(super) fn new(
dict: &'l DataPayload<UCharDictionaryBreakDataV1Marker>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (optional): Can you use this PR to address my unresolved comment from #3348

Nit: You should almost never have a

&'a DataPayload<FooV1Marker>

you should instead have a

&'a FooV1<'a>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually in this instance it really complicates things. Instead of being able to .map(Result::as_ref) I'd have to have a map that unpacks both values, and have that be conditional on the LSTM being the never type.

self.data
}

pub fn copy_submatrix<const M: usize>(&mut self, from: usize, to: usize) {
pub(super) fn copy_submatrix<const M: usize>(&mut self, from: usize, to: usize) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It seems more verbose to do this to all the methods. If you want to be explicit that it is pub(super),just label the class as such, not the individual methods on the class

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer it that way, because it makes the semver relevance clearer without hunting for the struct's definition.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

@robertbastian robertbastian requested a review from sffc April 20, 2023 15:57
@Manishearth Manishearth removed their request for review April 20, 2023 16:27
@robertbastian robertbastian merged commit e47591f into unicode-org:main Apr 20, 2023
@robertbastian robertbastian deleted the vis branch April 20, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-segmentation Component: Segmentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants