Functions | |
| def | extract_datetime_it (string, dateNow, default_time) |
| def | extract_numbers_it (text, short_scale=False, ordinals=False) |
| def | extractnumber_it (text, short_scale=False, ordinals=False) |
| def | extractnumber_long_it (word) |
| def | get_gender_it (word, raw_string="") |
| def | isFractional_it (input_str, short_scale=False) |
| def | normalize_it (text, remove_articles) |
Variables | |
| list | ARTICLES_IT = ['il', 'lo', 'la', 'i', 'gli', 'le'] |
| dictionary | LONG_ORDINAL_STRING_IT |
| dictionary | SHORT_ORDINAL_STRING_IT |
| dictionary | STRING_NUM_ITA |
| def mycroft.util.lang.parse_it.extract_datetime_it | ( | string, | |
| dateNow, | |||
| default_time | |||
| ) |
Definition at line 600 of file parse_it.py.
| def mycroft.util.lang.parse_it.extract_numbers_it | ( | text, | |
short_scale = False, |
|||
ordinals = False |
|||
| ) |
Takes in a string and extracts a list of numbers.
Args:
text (str): the string to extract a number from
short_scale (bool): Use "short scale" or "long scale" for large
numbers -- over a million. The default is short scale, which
is now common in most English speaking countries.
See https://en.wikipedia.org/wiki/Names_of_large_numbers
ordinals (bool): consider ordinal numbers, e.g. third=3 instead of 1/3
Returns:
list: list of extracted numbers as floats
Definition at line 1310 of file parse_it.py.
| def mycroft.util.lang.parse_it.extractnumber_it | ( | text, | |
short_scale = False, |
|||
ordinals = False |
|||
| ) |
This function extracts a number from a text string,
handles pronunciations in long scale and short scale
https://en.wikipedia.org/wiki/Names_of_large_numbers
Args:
text (str): the string to normalize
short_scale (bool): use short scale if True, long scale if False
ordinals (bool): consider ordinal numbers, third=3 instead of 1/3
Returns:
(int) or (float) or False: The extracted number or False if no number
was found
Definition at line 385 of file parse_it.py.
| def mycroft.util.lang.parse_it.extractnumber_long_it | ( | word | ) |
This function converts a long textual number like
milleventisette -> 1027 diecimila -> 10041 in
integer value, covers from 0 to 999999999999999
for now limited to 999_e21 but ready for 999_e63
example:
milleventisette -> 1027
diecimilaquarantuno-> 10041
centottomiladuecentotredici -> 108213
Args:
word (str): the word to convert in number
Returns:
(bool) or (int): The extracted number or False if no number
was found
Definition at line 223 of file parse_it.py.
| def mycroft.util.lang.parse_it.get_gender_it | ( | word, | |
raw_string = "" |
|||
| ) |
In Italian to define the grammatical gender of a word is necessary analyze the article that precedes the word and not only the last letter of the word. TODO: check if useful
Definition at line 1283 of file parse_it.py.
| def mycroft.util.lang.parse_it.isFractional_it | ( | input_str, | |
short_scale = False |
|||
| ) |
This function takes the given text and checks if it is a fraction.
Updated to italian from en version 18.8.9
Args:
input_str (str): the string to check if fractional
short_scale (bool): use short scale if True, long scale if False
Returns:
(bool) or (float): False if not a fraction, otherwise the fraction
Definition at line 191 of file parse_it.py.
| def mycroft.util.lang.parse_it.normalize_it | ( | text, | |
| remove_articles | |||
| ) |
IT string normalization
Definition at line 566 of file parse_it.py.
| list mycroft.util.lang.parse_it.ARTICLES_IT = ['il', 'lo', 'la', 'i', 'gli', 'le'] |
Definition at line 119 of file parse_it.py.
| dictionary mycroft.util.lang.parse_it.LONG_ORDINAL_STRING_IT |
Definition at line 74 of file parse_it.py.
| dictionary mycroft.util.lang.parse_it.SHORT_ORDINAL_STRING_IT |
Definition at line 30 of file parse_it.py.
| dictionary mycroft.util.lang.parse_it.STRING_NUM_ITA |
Definition at line 121 of file parse_it.py.