Commit Graph

16 Commits

Author SHA1 Message Date
Daniel Cartwright
8cb77a43c7 Add custom isRangeValid implementation for ZH
Summary: Fixes #313

Reviewed By: stroxler

Differential Revision: D28364035

fbshipit-source-id: 7fe3dba75410d217747a0d7a6f7df611ac26ec70
2021-06-04 12:48:32 -07:00
leandro.guisandez@pgconocimiento.com
5d8d99bbf4 Init
Summary: Initialise Time for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28455273

Pulled By: chessai

fbshipit-source-id: be9a4d61692ba4fb32986e161e9fdd6d25a357dc
2021-05-18 13:50:19 -07:00
Daniel Cartwright
69d951220e Make isRangeValid take Lang as input
Summary: There are different implementations of isRangeValid that work well for different languages, thus it makes sense to facilitate having different implementations based on the language.

Reviewed By: patapizza

Differential Revision: D28362777

fbshipit-source-id: 5f2991d54af3095c8e95cf534e2dd3b4a34dee3a
2021-05-17 13:18:11 -07:00
leandro.guisandez@pgconocimiento.com
173d8c235f Init
Summary: Initialise Duration for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28299352

Pulled By: chessai

fbshipit-source-id: d1d4dd186b9fbf018c83a0df4d752b29da20f04d
2021-05-12 17:33:54 -07:00
leandro.guisandez@pgconocimiento.com
0e3d0604a2 Init
Summary: Initialise Volume for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28298901

Pulled By: chessai

fbshipit-source-id: 72fd95062393b8b780e521b56b097b66e2263aef
2021-05-12 14:54:05 -07:00
leandro.guisandez@pgconocimiento.com
219e5600d6 Init
Summary: Initialise Temperature for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28298423

Pulled By: chessai

fbshipit-source-id: 73b87d002196b6b707388e9f83f42591510f40eb
2021-05-12 14:02:54 -07:00
leandro.guisandez@pgconocimiento.com
1322cd69ec Init
Summary: Initialises Distance for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28297521

Pulled By: chessai

fbshipit-source-id: eb8641568f5981ea6e2d481c305e36cdb683dcfb
2021-05-12 12:50:13 -07:00
leandro.guisandez@pgconocimiento.com
213d1f12a5 Init
Summary: Initialise AmountOfMoney for CA (Catalan) language

Reviewed By: stroxler

Differential Revision: D28296090

Pulled By: chessai

fbshipit-source-id: f02305a762ee3cbf357bbb0a65eef614d3d828c9
2021-05-12 11:32:18 -07:00
Steven Troxler
c44c73fe04 Numeral/ES: Add support for additive concatenations
Summary:
This commit extend Spanish-language support for concatenations
of the form "<higher-order-of-magnitude> <lower>", e.g.
"doscientos tres" (203) or "cuatro mil ventiuno" (4022) to work
not just for hundreds but also for thousands and millions.

Reviewed By: chessai

Differential Revision: D27858133

fbshipit-source-id: 5c6b227ae7dad9009cd636e7ea49c209480c931a
2021-04-23 09:48:07 -07:00
Steven Troxler
888da76215 Numeral/ES: Add support for 1M, and multiples of 1K/1M
Summary:
This commit adds two things to Spanish numeral support:
- support for millions
- support, via hooking into the `isMultipliable` logic used by EN, for
  composing counts of 2-999 with either "mil" or "millones", which is
  the standard way to say things like "tres mil" = 3000

Reviewed By: chessai

Differential Revision: D27858135

fbshipit-source-id: 980e95bd989f818c5ceaa2bb6c87fe81d3e08366
2021-04-23 09:48:06 -07:00
Steven Troxler
15bba9eba9 Numeral/ES: Refactor hundreds handling to fix bug
Summary:
This diff refactors our handling of "<hundreds> 0..99" numbers
to be more flexible by replacing `ruleNumeralthreePartHundreds`
with
- a rule for two-part hundreds like "dos cientos" (which is technically
  incorrect grammar - doscientos is correct - but probably worth keeping) based
  on a notion of multipliability like that used in EN rules
- a rule stating that we can compose hundreds with 0..99 additively

The resulting rules are more flexible, and they correctly parse not only
gramatically iffy phrases like "dos cientos tres", but also grammatically
correct phrases like "doscientos tres". This fixes #380.

Reviewed By: chessai

Differential Revision: D27858136

fbshipit-source-id: 4a918d84d93ac074f83f6947a8f80cfd11145115
2021-04-23 09:48:06 -07:00
Steven Troxler
bf696ba185 Time/EN: Allow dashes in spelled-out times
Summary:
It's common to use dashes when spelling out times longhand,
e.g. "five-thirty am", but Duckling wasn't handling this at all.

This commit adds rules for times spelled out with dashes. The
rules explicitly forbid the second of the two times from including
digits via a negative match. This is because
- it wouldn't be at all idomatic to write five-26 or five-oh-6
- allowing that pattern clashes with time range parsing, e.g.
  "9-10 am" should parse as a time range, not as "9:10 am"

Reviewed By: chessai

Differential Revision: D27848428

fbshipit-source-id: dfe8b98cb38119a16db2a19db47fd3128783e617
2021-04-22 11:47:28 -07:00
Steven Troxler
23ec021b07 Duration/RU: For non-int times, use the coarsest grain
Summary:
This commit fixes #111, which was an open issue that any non-integer
multiple of any unit of time was being converted to seconds.

My solution is to write a recursive function `Duration.Helpers.inCoarsestGrain`
which, given a grain `g` and double value `v` finds the coarses grain `g'` such that
`v * g` - rounded to the nearest seconds - has integral units.

We call this function only in the case of non-integer multiples, and we start our
search from the given grain because nothing coarser would make sense. The code could
actually be slightly more efficient if we started at the next-smallest grain, but
in the interest of clarity I think this is probably better.

Reviewed By: chessai

Differential Revision: D27891439

fbshipit-source-id: b048310963eb71337fd91ab4ef3c840134a76e73
2021-04-21 13:32:38 -07:00
Steven Troxler
35532b0b7c Time/EN: Tighten up handling of split times like "five ten"
Summary:
While debugging an attempt to extend our handling of spelled-out
times, I realized that we are being too aggressive in our parsing of
times like "five ten", because we'll parse "five nine" as possibly
meaning "5:09", which isn't something an English speaker would say
(or rather if they did, it's more likely they mean "five (to) six"
or something similar.

Reviewed By: chessai

Differential Revision: D27848429

fbshipit-source-id: 34d783332fd60359ad9b6e7862367453bc93a1d1
2021-04-20 05:31:53 -07:00
chessai
8ce33d81f5 Update CHANGELOG (#610)
Summary:
Recent changes were allowed in without changelog entries (my fault).
This adds entries for those changes.

Pull Request resolved: https://github.com/facebook/duckling/pull/610

Reviewed By: haoxuany

Differential Revision: D27867893

Pulled By: chessai

fbshipit-source-id: 6e3d9dce496f0f9344dcb65c5e2dd3f1f1c380eb
2021-04-19 16:02:32 -07:00
chessai
d712bee78b initialise changelog (#597)
Summary:
resolves https://github.com/facebook/duckling/issues/455

Pull Request resolved: https://github.com/facebook/duckling/pull/597

Reviewed By: girifb

Differential Revision: D27806129

Pulled By: chessai

fbshipit-source-id: 4bca273fef5df0848c2b92d3ac753b66cedfcdcb
2021-04-16 10:02:28 -07:00