Skip to content

Commit

Permalink
Portuguese V1
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannaSimoens authored and ClemDoum committed Jun 18, 2019
1 parent 85e858f commit 2627a17
Show file tree
Hide file tree
Showing 3 changed files with 2,093 additions and 132 deletions.
25 changes: 20 additions & 5 deletions grammar/it/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ pub fn rules_finance(b: &mut RuleSetBuilder<Dimension>) -> RustlingResult<()> {
);
// This is not recognized for a very obscure reason
b.rule_1_terminal("RUB",
b.reg(r#"rub(?:l[oi])?"#)?,
b.reg(r#"rub(?:l[oi])?(?: russ[oi])?"#)?,
|_| Ok(MoneyUnitValue { unit: Some("RUB") })
);
b.rule_1_terminal("INR",
b.reg(r#"inr|rupi[ae]"#)?,
b.reg(r#"inr|rupi[ae](?: indian[ae])?"#)?,
|_| Ok(MoneyUnitValue { unit: Some("INR") })
);
b.rule_1_terminal("JPY",
Expand Down Expand Up @@ -317,6 +317,16 @@ pub fn rules_duration(b: &mut RuleSetBuilder<Dimension>) -> RustlingResult<()> {
b.reg(r#"(?:all'in)?circa|più o meno"#)?,
|duration, _| Ok(duration.value().clone().precision(Precision::Approximate))
);
b.rule_2("exactly <duration>",
b.reg(r#"esattamente"#)?,
duration_check!(),
|_, duration| Ok(duration.value().clone().precision(Precision::Exact))
);
b.rule_2("<duration> exactly",
duration_check!(),
b.reg(r#"(?:esatt|precis)(?:[aoie]|amente)"#)?,
|duration, _| Ok(duration.value().clone().precision(Precision::Exact))
);
b.rule_2("during <duration>",
b.reg(r#"(?:durante|per)"#)?,
duration_check!(),
Expand Down Expand Up @@ -884,6 +894,11 @@ pub fn rules_time(b: &mut RuleSetBuilder<Dimension>) -> RustlingResult<()> {
integer_check_by_range!(1, 23),
|_, integer| Ok(helpers::hour(integer.value().value as u32, integer.value().value < 12)?.not_latent())
);
b.rule_2("<time-of-day> oclock",
b.reg(r#"l['e]"#)?,
integer_check_by_range!(1, 23),
|_, integer| Ok(helpers::hour(integer.value().value as u32, integer.value().value < 12)?.not_latent())
);
b.rule_2("around <time-of-day>",
b.reg(r#"verso|interno a|(?:approssim|indic|orient)ativamente|(?:all'in)?circa|più o meno|pressappoco|suppergiù|grosso modo"#)?,
time_check!(form!(Form::TimeOfDay(_))),
Expand Down Expand Up @@ -1729,9 +1744,9 @@ pub fn rules_temperature(b: &mut RuleSetBuilder<Dimension>) -> RustlingResult<()
latent: false,
})
});
b.rule_2("<latent temp> temp below zero",
temperature_check!(),
b.reg(r#"(?:grad[oi] |° )?(?:sotto (?:lo )?zero)"#)?,
b.rule_2("<temp> temp below zero",
temperature_check!(|temp: &TemperatureValue| !temp.latent),
b.reg(r#"sotto (?:lo )?zero"#)?,
|a, _| {
Ok(TemperatureValue {
value: -1.0 * a.value().value,
Expand Down
Loading

0 comments on commit 2627a17

Please sign in to comment.