Repository: allo-media/text2num

Issue:
forty five hundred thirty => 45 130 instead of 4530
Hello, 

I'm using your package and the alpha2digit method on english text.
The following text returns a wrong value :   
`forty five hundred thirty dollars and ninety cents` => `45 130 dollars and 90 cents`  
I'm expecting the following : `4530 dollars and 90 cents`

Discussion:

Patch:
diff --git a/text_to_num/lang/english.py b/text_to_num/lang/english.py
index 4286476..9332a37 100644
--- a/text_to_num/lang/english.py
+++ b/text_to_num/lang/english.py
@@ -32,6 +32,8 @@ from .base import Language
 # Those words multiplies lesser numbers (see Rules)
 # Special case: "hundred" is processed apart.
 MULTIPLIERS = {
+    "hundred": 100,
+    "hundreds": 100,
     "thousand": 1_000,
     "thousands": 1_000,
     "million": 1_000_000,
diff --git a/text_to_num/parsers.py b/text_to_num/parsers.py
index 72c3add..b406b81 100644
--- a/text_to_num/parsers.py
+++ b/text_to_num/parsers.py
@@ -120,11 +120,11 @@ class WordStreamValueParser(WordStreamValueParserInterface):
             return coef != self.value
 
         """Is this multiplier expected?"""
-        if coef > self.value and (self.value > 0 or coef >= 1000):
+        if coef > self.value and (self.value > 0 or coef >= 100):
             # a multiplier can be applied to anything lesser than itself,
             # as long as it not zero (special case for 1000 which then implies 1)
             return True
-        if coef * 1000 <= self.n000_val:
+        if coef * 1000 <= self.n000_val or coef == 100 and 100 > self.grp_val:
             # a multiplier can not be applied to a value bigger than itself,
             # so it must be applied to the current group only.
             # ex. for "mille": "deux millions cent cinquante mille"
@@ -133,7 +133,7 @@ class WordStreamValueParser(WordStreamValueParserInterface):
             # we test the 1000 × ``coef`` (as the multipliers above 100,
             # are a geometric progression of ratio 1000)
             return (
-                self.grp_val > 0 or coef == 1000
+                self.grp_val > 0 or coef == 1000 or coef == 100
             )  # "mille" without unit      is additive
         # TODO: There is one exception to the above rule: "de milliard"
         # ex. : "mille milliards de milliards"
@@ -175,6 +175,10 @@ class WordStreamValueParser(WordStreamValueParserInterface):
                 return False
             # a multiplier can not be applied to a value bigger than itself,
             # so it must be applied to the current group
+            if coef < 1000:
+                self.grp_val = (self.grp_val or 1) * coef
+                self.last_word = None
+                return True
             if coef < self.n000_val:
                 self.n000_val = self.n000_val + coef * (
                     self.grp_val or 1


Test patch:
diff --git a/tests/test_text_to_num_en.py b/tests/test_text_to_num_en.py
index d12341b..640d7c4 100644
--- a/tests/test_text_to_num_en.py
+++ b/tests/test_text_to_num_en.py
@@ -51,13 +51,10 @@ class TestTextToNumEN(TestCase):
         self.assertEqual(text2num("thousand nine hundred twenty", "en"), 1920)
         self.assertEqual(text2num("one billion twenty-five millions", "en"), 1_025_000_000)
 
-    def test_text2num_centuries(self):
-        self.assertEqual(text2num("nineteen hundred seventy-three", "en"), 1973)
-
     def test_text2num_exc(self):
         self.assertRaises(ValueError, text2num, "thousand thousand two hundreds", "en")
         self.assertRaises(ValueError, text2num, "sixty fifteen", "en")
-        self.assertRaises(ValueError, text2num, "sixty hundred", "en")
+        self.assertRaises(ValueError, text2num, "hundred hundreds", "en")
 
     def test_text2num_zeroes(self):
         self.assertEqual(text2num("zero", "en"), 0)
@@ -67,6 +64,13 @@ class TestTextToNumEN(TestCase):
         self.assertRaises(ValueError, text2num, "fifty zero three", "en")
         self.assertRaises(ValueError, text2num, "fifty three zero", "en")
 
+    def test_text2num_hundreds(self):
+        source = "forty five hundred thirty eight"
+        expected = 4538
+        self.assertEqual(text2num(source, "en"), expected)
+        self.assertEqual(text2num("nineteen hundred seventy-three", "en"), 1973)
+        self.assertEqual(text2num("sixty hundred", "en"), 6000)
+
     def test_alpha2digit_integers(self):
         source = "twenty-five cows, twelve chickens and one hundred twenty five kg of potatoes."
         expected = "25 cows, 12 chickens and 125 kg of potatoes."
@@ -97,6 +101,11 @@ class TestTextToNumEN(TestCase):
         expected = "34 = 34"
         self.assertEqual(alpha2digit(source, "en", relaxed=True), expected)
 
+    def test_alpha2digit_hundreds(self):
+        source = "forty five hundred thirty eight dollars and eighteen cents"
+        expected = "4538 dollars and 18 cents"
+        self.assertEqual(alpha2digit(source, "en"), expected)
+
     def test_alpha2digit_formal(self):
         source = "plus thirty-three nine sixty zero six twelve twenty-one"
         expected = "+33 9 60 06 12 21"