ovos-number-parser 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ovos-number-parser-0.0.1/PKG-INFO +225 -0
- ovos-number-parser-0.0.1/README.md +206 -0
- ovos-number-parser-0.0.1/ovos_number_parser/__init__.py +274 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_az.py +1085 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_ca.py +468 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_cs.py +1232 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_da.py +493 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_de.py +830 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_en.py +1079 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_es.py +693 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_eu.py +493 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_fa.py +405 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_fr.py +695 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_hu.py +286 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_it.py +915 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_nl.py +938 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_pl.py +1072 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_pt.py +499 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_ru.py +1247 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_sl.py +463 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_sv.py +503 -0
- ovos-number-parser-0.0.1/ovos_number_parser/numbers_uk.py +1377 -0
- ovos-number-parser-0.0.1/ovos_number_parser/util.py +180 -0
- ovos-number-parser-0.0.1/ovos_number_parser/version.py +6 -0
- ovos-number-parser-0.0.1/ovos_number_parser.egg-info/PKG-INFO +225 -0
- ovos-number-parser-0.0.1/ovos_number_parser.egg-info/SOURCES.txt +29 -0
- ovos-number-parser-0.0.1/ovos_number_parser.egg-info/dependency_links.txt +1 -0
- ovos-number-parser-0.0.1/ovos_number_parser.egg-info/requires.txt +1 -0
- ovos-number-parser-0.0.1/ovos_number_parser.egg-info/top_level.txt +1 -0
- ovos-number-parser-0.0.1/setup.cfg +4 -0
- ovos-number-parser-0.0.1/setup.py +81 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ovos-number-parser
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: OpenVoiceOS's multilingual text parsing and formatting library
|
|
5
|
+
Home-page: https://github.com/OpenVoiceOS/ovos-number-parser
|
|
6
|
+
Author: Mycroft AI / OVOS
|
|
7
|
+
Author-email: jarbasai@mailfence.com
|
|
8
|
+
License: Apache2.0
|
|
9
|
+
Description: # OVOS Number Parser
|
|
10
|
+
|
|
11
|
+
OVOS Number Parser is a tool for extracting, pronouncing, and detecting numbers from text across multiple languages. It
|
|
12
|
+
supports functionalities like converting numbers to their spoken forms, extracting numbers from text, identifying
|
|
13
|
+
fractional and ordinal numbers, and more.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Pronounce Numbers:** Converts numerical values to their spoken forms.
|
|
18
|
+
- **Pronounce Ordinals:** Converts numbers to their ordinal forms.
|
|
19
|
+
- **Extract Numbers:** Extracts numbers from textual inputs.
|
|
20
|
+
- **Detect Fractions:** Identifies fractional expressions.
|
|
21
|
+
- **Detect Ordinals:** Checks if a text input contains an ordinal number.
|
|
22
|
+
|
|
23
|
+
## Supported Languages
|
|
24
|
+
|
|
25
|
+
| Language Code | Pronounce Number | Pronounce Ordinal | Extract Number | numbers_to_digits |
|
|
26
|
+
|-------------------------|------------------|-------------------|----------------|-------------------|
|
|
27
|
+
| `en` (English) | ✅ | ❌ | ✅ | ✅ |
|
|
28
|
+
| `az` (Azerbaijani) | ✅ | ❌ | ✅ | ✅ |
|
|
29
|
+
| `ca` (Catalan) | ✅ | ❌ | ✅ | ❌ |
|
|
30
|
+
| `cs` (Czech) | ✅ | ❌ | ✅ | ✅ |
|
|
31
|
+
| `da` (Danish) | ✅ | ✅ | ✅ | ❌ |
|
|
32
|
+
| `de` (German) | ✅ | ✅ | ✅ | ✅ |
|
|
33
|
+
| `es` (Spanish) | ✅ | ❌ | ✅ | ✅ |
|
|
34
|
+
| `eu` (Euskara / Basque) | ✅ | ❌ | ✅ | ❌ |
|
|
35
|
+
| `fa` (Farsi / Persian) | ✅ | ❌ | ✅ | ❌ |
|
|
36
|
+
| `fr` (French) | ✅ | ❌ | ✅ | ❌ |
|
|
37
|
+
| `hu` (Hungarian) | ✅ | ✅ | ❌ | ❌ |
|
|
38
|
+
| `it` (Italian) | ✅ | ❌ | ✅ | ❌ |
|
|
39
|
+
| `nl` (Dutch) | ✅ | ✅ | ✅ | ✅ |
|
|
40
|
+
| `pl` (Polish) | ✅ | ❌ | ✅ | ✅ |
|
|
41
|
+
| `pt` (Portuguese) | ✅ | ❌ | ✅ | ✅ |
|
|
42
|
+
| `ru` (Russian) | ✅ | ❌ | ✅ | ✅ |
|
|
43
|
+
| `sv` (Swedish) | ✅ | ✅ | ✅ | ❌ |
|
|
44
|
+
| `sl` (Slovenian) | ✅ | ❌ | ❌ | ❌ |
|
|
45
|
+
| `uk` (Ukrainian) | ✅ | ❌ | ✅ | ✅ |
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
To install OVOS Number Parser, use:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install ovos-number-parser
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Pronounce a Number
|
|
58
|
+
|
|
59
|
+
Convert a number to its spoken equivalent.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
def pronounce_number(number: Union[int, float], lang: str, places: int = 2, short_scale: bool = True,
|
|
63
|
+
scientific: bool = False, ordinals: bool = False) -> str:
|
|
64
|
+
"""
|
|
65
|
+
Convert a number to its spoken equivalent.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
number: The number to pronounce.
|
|
69
|
+
lang (str): A BCP-47 language code.
|
|
70
|
+
places (int): Number of decimal places to express. Default is 2.
|
|
71
|
+
short_scale (bool): Use short (True) or long scale (False) for large numbers.
|
|
72
|
+
scientific (bool): Pronounce in scientific notation if True.
|
|
73
|
+
ordinals (bool): Pronounce as an ordinal if True.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
str: The pronounced number.
|
|
77
|
+
"""
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Example Usage:**
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from ovos_number_parser import pronounce_number
|
|
84
|
+
|
|
85
|
+
# Example
|
|
86
|
+
result = pronounce_number(123, "en")
|
|
87
|
+
print(result) # "one hundred and twenty-three"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Pronounce an Ordinal
|
|
91
|
+
|
|
92
|
+
Convert a number to its ordinal spoken equivalent.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
def pronounce_ordinal(number: Union[int, float], lang: str, short_scale: bool = True) -> str:
|
|
96
|
+
"""
|
|
97
|
+
Convert an ordinal number to its spoken equivalent.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
number: The number to pronounce.
|
|
101
|
+
lang (str): A BCP-47 language code.
|
|
102
|
+
short_scale (bool): Use short (True) or long scale (False) for large numbers.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
str: The pronounced ordinal number.
|
|
106
|
+
"""
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Example Usage:**
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from ovos_number_parser import pronounce_ordinal
|
|
113
|
+
|
|
114
|
+
# Example
|
|
115
|
+
result = pronounce_ordinal(5, "en")
|
|
116
|
+
print(result) # "fifth"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Extract a Number
|
|
120
|
+
|
|
121
|
+
Extract a number from a given text string.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
def extract_number(text: str, lang: str, short_scale: bool = True, ordinals: bool = False) -> Union[int, float, bool]:
|
|
125
|
+
"""
|
|
126
|
+
Extract a number from text.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
text (str): The string to extract a number from.
|
|
130
|
+
lang (str): A BCP-47 language code.
|
|
131
|
+
short_scale (bool): Use short scale if True, long scale if False.
|
|
132
|
+
ordinals (bool): Consider ordinal numbers.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
int, float, or False: The extracted number, or False if no number found.
|
|
136
|
+
"""
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Example Usage:**
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from ovos_number_parser import extract_number
|
|
143
|
+
|
|
144
|
+
# Example
|
|
145
|
+
result = extract_number("I have twenty apples", "en")
|
|
146
|
+
print(result) # 20
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Check for Fractional Numbers
|
|
150
|
+
|
|
151
|
+
Identify if the text contains a fractional number.
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
def is_fractional(input_str: str, lang: str, short_scale: bool = True) -> Union[bool, float]:
|
|
155
|
+
"""
|
|
156
|
+
Check if the text is a fraction.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
input_str (str): The string to check if fractional.
|
|
160
|
+
lang (str): A BCP-47 language code.
|
|
161
|
+
short_scale (bool): Use short scale if True, long scale if False.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
bool or float: False if not a fraction, otherwise the fraction as a float.
|
|
165
|
+
"""
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Example Usage:**
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from ovos_number_parser import is_fractional
|
|
172
|
+
|
|
173
|
+
# Example
|
|
174
|
+
result = is_fractional("half", "en")
|
|
175
|
+
print(result) # 0.5
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Check for Ordinals
|
|
179
|
+
|
|
180
|
+
Determine if the text contains an ordinal number.
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
def is_ordinal(input_str: str, lang: str) -> Union[bool, float]:
|
|
184
|
+
"""
|
|
185
|
+
Check if the text is an ordinal number.
|
|
186
|
+
|
|
187
|
+
Args:
|
|
188
|
+
input_str (str): The string to check if ordinal.
|
|
189
|
+
lang (str): A BCP-47 language code.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
bool or float: False if not an ordinal, otherwise the ordinal as a float.
|
|
193
|
+
"""
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Example Usage:**
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from ovos_number_parser import is_ordinal
|
|
200
|
+
|
|
201
|
+
# Example
|
|
202
|
+
result = is_ordinal("third", "en")
|
|
203
|
+
print(result) # 3
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Related Projects
|
|
207
|
+
|
|
208
|
+
- [ovos-date-parser](https://github.com/OpenVoiceOS/ovos-date-parser) - for handling dates and times
|
|
209
|
+
- [ovos-lang-parser](https://github.com/OVOSHatchery/ovos-lang-parser) - for handling languages
|
|
210
|
+
- [ovos-color-parser](https://github.com/OVOSHatchery/ovos-color-parser) - for handling colors
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
This project is licensed under the Apache License 2.0.
|
|
215
|
+
Platform: UNKNOWN
|
|
216
|
+
Classifier: Development Status :: 4 - Beta
|
|
217
|
+
Classifier: Intended Audience :: Developers
|
|
218
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
219
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
220
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
221
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
222
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
223
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
224
|
+
Obsoletes: ovos_number_parser
|
|
225
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# OVOS Number Parser
|
|
2
|
+
|
|
3
|
+
OVOS Number Parser is a tool for extracting, pronouncing, and detecting numbers from text across multiple languages. It
|
|
4
|
+
supports functionalities like converting numbers to their spoken forms, extracting numbers from text, identifying
|
|
5
|
+
fractional and ordinal numbers, and more.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Pronounce Numbers:** Converts numerical values to their spoken forms.
|
|
10
|
+
- **Pronounce Ordinals:** Converts numbers to their ordinal forms.
|
|
11
|
+
- **Extract Numbers:** Extracts numbers from textual inputs.
|
|
12
|
+
- **Detect Fractions:** Identifies fractional expressions.
|
|
13
|
+
- **Detect Ordinals:** Checks if a text input contains an ordinal number.
|
|
14
|
+
|
|
15
|
+
## Supported Languages
|
|
16
|
+
|
|
17
|
+
| Language Code | Pronounce Number | Pronounce Ordinal | Extract Number | numbers_to_digits |
|
|
18
|
+
|-------------------------|------------------|-------------------|----------------|-------------------|
|
|
19
|
+
| `en` (English) | ✅ | ❌ | ✅ | ✅ |
|
|
20
|
+
| `az` (Azerbaijani) | ✅ | ❌ | ✅ | ✅ |
|
|
21
|
+
| `ca` (Catalan) | ✅ | ❌ | ✅ | ❌ |
|
|
22
|
+
| `cs` (Czech) | ✅ | ❌ | ✅ | ✅ |
|
|
23
|
+
| `da` (Danish) | ✅ | ✅ | ✅ | ❌ |
|
|
24
|
+
| `de` (German) | ✅ | ✅ | ✅ | ✅ |
|
|
25
|
+
| `es` (Spanish) | ✅ | ❌ | ✅ | ✅ |
|
|
26
|
+
| `eu` (Euskara / Basque) | ✅ | ❌ | ✅ | ❌ |
|
|
27
|
+
| `fa` (Farsi / Persian) | ✅ | ❌ | ✅ | ❌ |
|
|
28
|
+
| `fr` (French) | ✅ | ❌ | ✅ | ❌ |
|
|
29
|
+
| `hu` (Hungarian) | ✅ | ✅ | ❌ | ❌ |
|
|
30
|
+
| `it` (Italian) | ✅ | ❌ | ✅ | ❌ |
|
|
31
|
+
| `nl` (Dutch) | ✅ | ✅ | ✅ | ✅ |
|
|
32
|
+
| `pl` (Polish) | ✅ | ❌ | ✅ | ✅ |
|
|
33
|
+
| `pt` (Portuguese) | ✅ | ❌ | ✅ | ✅ |
|
|
34
|
+
| `ru` (Russian) | ✅ | ❌ | ✅ | ✅ |
|
|
35
|
+
| `sv` (Swedish) | ✅ | ✅ | ✅ | ❌ |
|
|
36
|
+
| `sl` (Slovenian) | ✅ | ❌ | ❌ | ❌ |
|
|
37
|
+
| `uk` (Ukrainian) | ✅ | ❌ | ✅ | ✅ |
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
To install OVOS Number Parser, use:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install ovos-number-parser
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Pronounce a Number
|
|
50
|
+
|
|
51
|
+
Convert a number to its spoken equivalent.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
def pronounce_number(number: Union[int, float], lang: str, places: int = 2, short_scale: bool = True,
|
|
55
|
+
scientific: bool = False, ordinals: bool = False) -> str:
|
|
56
|
+
"""
|
|
57
|
+
Convert a number to its spoken equivalent.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
number: The number to pronounce.
|
|
61
|
+
lang (str): A BCP-47 language code.
|
|
62
|
+
places (int): Number of decimal places to express. Default is 2.
|
|
63
|
+
short_scale (bool): Use short (True) or long scale (False) for large numbers.
|
|
64
|
+
scientific (bool): Pronounce in scientific notation if True.
|
|
65
|
+
ordinals (bool): Pronounce as an ordinal if True.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
str: The pronounced number.
|
|
69
|
+
"""
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Example Usage:**
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from ovos_number_parser import pronounce_number
|
|
76
|
+
|
|
77
|
+
# Example
|
|
78
|
+
result = pronounce_number(123, "en")
|
|
79
|
+
print(result) # "one hundred and twenty-three"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Pronounce an Ordinal
|
|
83
|
+
|
|
84
|
+
Convert a number to its ordinal spoken equivalent.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
def pronounce_ordinal(number: Union[int, float], lang: str, short_scale: bool = True) -> str:
|
|
88
|
+
"""
|
|
89
|
+
Convert an ordinal number to its spoken equivalent.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
number: The number to pronounce.
|
|
93
|
+
lang (str): A BCP-47 language code.
|
|
94
|
+
short_scale (bool): Use short (True) or long scale (False) for large numbers.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
str: The pronounced ordinal number.
|
|
98
|
+
"""
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Example Usage:**
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from ovos_number_parser import pronounce_ordinal
|
|
105
|
+
|
|
106
|
+
# Example
|
|
107
|
+
result = pronounce_ordinal(5, "en")
|
|
108
|
+
print(result) # "fifth"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Extract a Number
|
|
112
|
+
|
|
113
|
+
Extract a number from a given text string.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
def extract_number(text: str, lang: str, short_scale: bool = True, ordinals: bool = False) -> Union[int, float, bool]:
|
|
117
|
+
"""
|
|
118
|
+
Extract a number from text.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
text (str): The string to extract a number from.
|
|
122
|
+
lang (str): A BCP-47 language code.
|
|
123
|
+
short_scale (bool): Use short scale if True, long scale if False.
|
|
124
|
+
ordinals (bool): Consider ordinal numbers.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
int, float, or False: The extracted number, or False if no number found.
|
|
128
|
+
"""
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Example Usage:**
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from ovos_number_parser import extract_number
|
|
135
|
+
|
|
136
|
+
# Example
|
|
137
|
+
result = extract_number("I have twenty apples", "en")
|
|
138
|
+
print(result) # 20
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Check for Fractional Numbers
|
|
142
|
+
|
|
143
|
+
Identify if the text contains a fractional number.
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
def is_fractional(input_str: str, lang: str, short_scale: bool = True) -> Union[bool, float]:
|
|
147
|
+
"""
|
|
148
|
+
Check if the text is a fraction.
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
input_str (str): The string to check if fractional.
|
|
152
|
+
lang (str): A BCP-47 language code.
|
|
153
|
+
short_scale (bool): Use short scale if True, long scale if False.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
bool or float: False if not a fraction, otherwise the fraction as a float.
|
|
157
|
+
"""
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Example Usage:**
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from ovos_number_parser import is_fractional
|
|
164
|
+
|
|
165
|
+
# Example
|
|
166
|
+
result = is_fractional("half", "en")
|
|
167
|
+
print(result) # 0.5
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Check for Ordinals
|
|
171
|
+
|
|
172
|
+
Determine if the text contains an ordinal number.
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
def is_ordinal(input_str: str, lang: str) -> Union[bool, float]:
|
|
176
|
+
"""
|
|
177
|
+
Check if the text is an ordinal number.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
input_str (str): The string to check if ordinal.
|
|
181
|
+
lang (str): A BCP-47 language code.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
bool or float: False if not an ordinal, otherwise the ordinal as a float.
|
|
185
|
+
"""
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Example Usage:**
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from ovos_number_parser import is_ordinal
|
|
192
|
+
|
|
193
|
+
# Example
|
|
194
|
+
result = is_ordinal("third", "en")
|
|
195
|
+
print(result) # 3
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Related Projects
|
|
199
|
+
|
|
200
|
+
- [ovos-date-parser](https://github.com/OpenVoiceOS/ovos-date-parser) - for handling dates and times
|
|
201
|
+
- [ovos-lang-parser](https://github.com/OVOSHatchery/ovos-lang-parser) - for handling languages
|
|
202
|
+
- [ovos-color-parser](https://github.com/OVOSHatchery/ovos-color-parser) - for handling colors
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the Apache License 2.0.
|