# Twist on words to numbers [closed]

## The Goal

The goal of this question is to put a twist on this question. Your answer should be able to convert an array of words associated with integers into those integers. As an extra challenge, allow support for  , +, -, and _ in between numbers such as sixty seven, sixty+seven, sixty-seven, or sixty_seven.

## Examples

General Example: one, twenty-two, eleven, thirty+five, forty eight => 1, 22, 11, 35, 48.
General Example: ninety_two, eighty one, zero, seventy+seven, nine => 92, 81, 0, 77, 9.
Javascript/Node.JS Example: ['five', 'twenty+eight', 'fifty_two', 'thirty', 'zero'] => [5, 28, 52, 30, 0]

## Assumptions

• There are no negative numbers
• The applicable numbers only need to be 0-99
• The array will not be empty

## Scoring

As this is code-golf, let the answer with the fewest amount of bytes win. Good luck.

• Yes, but... If twenty+two is 22, why twenty-two isn't 18?
– tsh
Commented Dec 29, 2020 at 8:15
• @tsh what do you mean? Commented Dec 29, 2020 at 8:16
• Welcome to CG&CC! I VTCed as "needs details or clarity" because there's no actual, self-contained specification of what words the input could consist of or how to handle them. I also don't feel like the challenge gains anything from the array I/O, as opposed to converting a single number, but that's more subjective. This could benefit from some Sandbox time. Commented Dec 29, 2020 at 8:29

# JavaScript (Node.js), 127 bytes

a=>a.map(s=>s.replace(/[a-z]+/g,s=>t+=Buffer(3!S~0?.']5~g)~~~#I*~{2"&+,/-~4~\$%q~(1)[parseInt(s,36)%620%546%115%37]-33,t=0)|t)


Try it online!

Below is a summary of the hash function, which gives a result in $$\[0..36]\$$ with a few unused slots.

 string      | base 36 -> dec. | mod 620 | mod 546 | mod 115 | mod 37
-------------+-----------------+---------+---------+---------+--------
'zero'      |  1652100        |   420   |   420   |   75    |  1
'one'       |  31946          |   326   |   326   |   96    |  22
'two'       |  38760          |   320   |   320   |   90    |  16
'three'     |  49537526       |   146   |   146   |   31    |  31
'four'      |  732051         |   451   |   451   |   106   |  32
'five'      |  724298         |   138   |   138   |   23    |  23
'six'       |  36969          |   389   |   389   |   44    |  7
'seven'     |  47723135       |   495   |   495   |   35    |  35
'eight'     |  24375809       |   509   |   509   |   49    |  12
'nine'      |  1097258        |   478   |   478   |   18    |  18
'ten'       |  38111          |   291   |   291   |   61    |  24
'eleven'    |  882492287      |   407   |   407   |   62    |  25
'twelve'    |  1807948346     |   446   |   446   |   101   |  27
'thirteen'  |  2310701170991  |   351   |   351   |   6     |  6
'fourteen'  |  1229565944111  |   371   |   371   |   26    |  26
'fifteen'   |  33766692143    |   423   |   423   |   78    |  4
'sixteen'   |  62095095599    |   619   |   73    |   73    |  36
'seventeen' |  80156542487855 |   95    |   95    |   95    |  21
'eighteen'  |  1137277763375  |   115   |   115   |   0     |  0
'nineteen'  |  1842973464623  |   103   |   103   |   103   |  29
'twenty'    |  1807950886     |   506   |   506   |   46    |  9
'thirty'    |  1782948454     |   194   |   194   |   79    |  5
'forty'     |  26350054       |   54    |   54    |   54    |  17
'fifty'     |  26054566       |   306   |   306   |   76    |  2
'sixty'     |  47912902       |   542   |   542   |   82    |  8
'seventy'   |  61849184038    |   278   |   278   |   48    |  11
'eighty'    |  877529158      |   378   |   378   |   33    |  33
'ninety'    |  1422047446     |   566   |   20    |   20    |  20