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

Add MessageFormat2 support with ICU4J executor #175

Merged
merged 35 commits into from
Jun 24, 2024

Conversation

mradbourne
Copy link
Contributor

No description provided.

@mradbourne mradbourne changed the title Add draft test schema Add draft MessageFormat2 test schema Feb 5, 2024
@sven-oly
Copy link
Collaborator

sven-oly commented Feb 5, 2024

Thanks for your work on this. I look forward to integrating MF2!

@mradbourne mradbourne changed the title Add draft MessageFormat2 test schema Add MessageFormat2 support with ICU4J executor Feb 27, 2024

# Utility functions
def computeMaxDigitsForCount(count):
return math.ceil(math.log10(count + 1))


def readFile(filename, version=''):
def readFile(filename, version='', filetype='txt'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does Python allow people to attach doc strings for methods? Can you add a source doc string to document filetype as having special behavior when you provide a value in the set of ['json']?

@mradbourne mradbourne force-pushed the messageformat2-icu4j branch from 7b4c9f4 to 1bb65d5 Compare March 12, 2024 11:27
@echeran
Copy link
Collaborator

echeran commented Mar 12, 2024

FYI, the current failure in the end-to-end job in CI is related to a configuration mistake in the Dart intl4x library that has been fixed and should roll out soon. It's obviously unrelated to our work, so ignore it for now.

"value": 1.2
}
],
"verify": "=1.2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I predict this test expected value is not correct and will need changing, once we get the test data hooked up to the executor. Plural selection happens on the "formatted" number (more precisely: the formatted-to-parts result, which comes after rounding is performed, notation changes applied, units are added, etc.), not the input number. I would expect the result to be other.

By contrast, the previous test case's expected value seems fine, since 1.2 :integer -> 1 (formatted) -> ONE plural category (selection on formatted value).

"value": 1.2
}
],
"verify": "=1.2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto, but double problem: formatting should return 1. The matching ought not to happen on the localized formatted string, but even if it did, the resulting string would be =1,2, right? Also, does our syntax support , in a number literal? It doesn't seem so.

"description": "",
"tests": [
]
}
Copy link
Collaborator

@echeran echeran Apr 10, 2024

Choose a reason for hiding this comment

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

is this file proper JSON? the object that begins on line 1 ends on line 6.

beyond that, this file and some others that follow don't specify the default locale, FYI.

@echeran
Copy link
Collaborator

echeran commented Jun 23, 2024

@mradbourne @sven-oly Okay, I think this PR is ready to merge. I think I have it working locally. Here are some notes and caveats:

  • This is the result page from my local run:
    image
  • I'm not sure why the JSON isn't rendering the charts locally... it used do that without problems... but now, it complains about a CORS error from the webpage. I believe that is a separate issue that is independent of the work in this PR.
  • Only about half of the tests from the source test data (originally sourced from the MFWG repo) are being executed. The reason is that they are asserting that an error should occur. That's a good and valid test, but I'm not currently sure that our test framework is currently able to handle that. We should change it to handle that -- I filed Support negative tests that expect errors (in MF2 tests) #242 for that
  • About 80% of tests result in an error, and the remainder are test failures
    • Errors are caused by the syntax analyzer failing when attempting to parse the input pattern string. I don't want to presume the cause one way or the other, except to say that implementation was going on in parallel with spec work under tight deadlines, so it's not entirely surprising
    • Failures seem to all be caused by the tests expecting a placeholder's best effort formatted substring to be {:placeholderName}, but the ICU4J 75 MF2 implementation returns :placeholderName. Again, not saying which is right or wrong, but we should take a closer look and resolve that against what we think it should look like.
  • I don't think this explains most of the error cases, but the test generator and executor should make sure to recognize runtime args when they are of type number and datetime, according to the MFWG testing design. So I filed Parse message_fmt2 API runtime args of type number and datetime args accordingly #243 to do followup work.

@echeran echeran marked this pull request as ready for review June 23, 2024 06:59
@echeran echeran requested a review from sven-oly June 23, 2024 06:59
@echeran
Copy link
Collaborator

echeran commented Jun 24, 2024

Ah, I forgot that properly viewing the output locally requires running a webserver via python3 -m http.server 8000 and via the webserver, opening up /TEMP_DATA/testReports/index.html.

We have a graph now. Even though there are no passing tests, the information is useful in surfacing the disparities between implementation and spec design. Surfacing that type information so that people can act on it is what we're trying to achieve, so I think this is good to merge. We can leave the followup of fixing for a separate task.

image

Copy link
Collaborator

@sven-oly sven-oly left a comment

Choose a reason for hiding this comment

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

OK, let's try this!

@echeran echeran merged commit 5b7d66d into unicode-org:main Jun 24, 2024
6 checks passed
@mradbourne mradbourne deleted the messageformat2-icu4j branch July 5, 2024 11:58
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.

None yet

3 participants