Skip to content

Some sample unitPreferences data for discussing output format. - #14

Merged
sffc merged 7 commits into
sffc:units-stagingfrom
hugovdm:units-usages-sampledata
Feb 18, 2020
Merged

sffc merged 7 commits into
sffc:units-stagingfrom
hugovdm:units-usages-sampledata

Conversation

@hugovdm

@hugovdm hugovdm commented Jan 21, 2020

Copy link
Copy Markdown
Collaborator

Let's discuss the desired output format with this limited sample, as we did with unitConversion sample data.

I realised the "geq" value also has to be in the output XPath, not in a value, since it is needed for distinguishing e.g. precision-increment/10 from precision-increment/50 for length/road-travel.

}
SE{
mile-scandinavian{
alt{"informal"}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Question for @macchiati: does alt="informal" imply that the fallback chain should be used or not? For example, if SE has foot for small road distance (not alt), and alt="informal" mile-scandanavian, if the alt is requested, do we use feet or not?

@hugovdm hugovdm left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixing mix of tabs spaces.

@hugovdm

hugovdm commented Jan 23, 2020

Copy link
Copy Markdown
Collaborator Author

ldml2icu also has a feature, which can produce what we have here minus the integer enumerations (so the same, just s/\s*\d{/\s*{/ (i.e. dropping the single digits, the reset stays the same). I'll try to produce that.

@sffc sffc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

One small comment, but other than that, looks great!

@macchiati

macchiati commented Feb 12, 2020 •

Copy link
Copy Markdown

In the doc https://docs.google.com/document/d/1JxId6OP3oh4UEwHdhZ0qOjkTExMwk72xtKBLBlohDtQ/edit, we have the structure:

<unitPreferences category="length" usage="road">
  <unitPreference regions="CA IN US" unit="foot" />
  <unitPreference regions="CA IN US" geq=”67” unit="yard" /> <!-- 200 feet -->
  <unitPreference regions="CA IN US" geq="0.568" unit="mile" /> <!-- 1000 yards -->
...

That doesn't seem to correspond to what you have, but would be more like:

length {
  road {
    CA {
      0 {foot} // 0 = default; we would test the absolute value so that works
      61.2648 {yard} // measures converted to baseUnit for length, ie meters
      914.10739 {mile}
     }
   ...
  person {
   ...
area {
...

@sffc

sffc commented Feb 12, 2020

Copy link
Copy Markdown
Owner

The structure Hugo has here I think is appropriate for the implementation. The converter spec will map from the XML structure to the "JSON" structure. For example, we need to use vecs rather than tables because the maps will be sorted in undesirable ways.

@macchiati

Copy link
Copy Markdown

That makes sense for the bottom level, changing this into an array of pairs.
{
0 {foot} // 0 = default; we would test the absolute value so that works
61.2648 {yard} // measures converted to baseUnit for length, ie meters
914.10739 {mile}
}

My main question is on the higher levels; it feels like the unitQuantity is the highest level, and then usage then region. That also matches more closely what we have in CLDR, making it easier to reformat (though that is a minor consideration).

=====

Second issue is that for some other data we end up sharing items, to cut down on space. Something like the following. Now, since this is just data sharing and the ICU format is changeable, we could do this or other things later if it makes sense.

length {
road {
CA { set1 }
US { set1}

sets {
set1 {
0 {foot} // 0 = default; we would test the absolute value so that works
61.2648 {yard} // measures converted to baseUnit for length, ie meters
914.10739 {mile}
}
set2 {
....

@sffc

sffc commented Feb 13, 2020

Copy link
Copy Markdown
Owner

I'm open to the idea of sets to help organize this a bit better. I feel like it might be premature optimization, though. There isn't really very much data here; it is all in supplemental, so we don't get the additional locale multiplier for size either.

@macchiati

Copy link
Copy Markdown

Makes sense.

@hugovdm

hugovdm commented Feb 17, 2020

Copy link
Copy Markdown
Collaborator Author

I've removed the unrelated changes. This is therefore good sample data in the format we seem to have reached consensus on. Next up, I'll try to add back all the data that I've dropped (due to being in the old format).

I think this branch can be merged (git merge) by Younies, if he wants to start using this sample data. If in the future we change the format again, I'd be happy to help fix all the unit tests that break as a consequence.

@hugovdm
hugovdm marked this pull request as ready for review February 17, 2020 11:16
@sffc

sffc commented Feb 18, 2020

Copy link
Copy Markdown
Owner

Let's get this into units-staging so that we can move forward.

@sffc
sffc merged commit 31b814d into sffc:units-staging Feb 18, 2020
@hugovdm
hugovdm deleted the units-usages-sampledata branch April 27, 2020 21:05
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