Functions | Variables
mycroft.util.lang.format_it Namespace Reference

Functions

def nice_number_it (number, speech, denominators)
 
def nice_time_it (dt, speech=True, use_24hour=False, use_ampm=False)
 
def pronounce_number_it (num, places=2, short_scale=False, scientific=False)
 

Variables

dictionary FRACTION_STRING_IT
 
 LONG_SCALE_IT
 
dictionary NUM_STRING_IT
 
 SHORT_SCALE_IT
 

Function Documentation

def mycroft.util.lang.format_it.nice_number_it (   number,
  speech,
  denominators 
)
Italian helper for nice_number

This function formats a float to human understandable functions. Like
4.5 becomes "4 e un mezz" for speech and "4 1/2" for text

Args:
    number (int or float): the float to format
    speech (bool): format for speech (True) or display (False)
    denominators (iter of ints): denominators to use, default [1 .. 20]
Returns:
    (str): The formatted string.

Definition at line 181 of file format_it.py.

def mycroft.util.lang.format_it.nice_time_it (   dt,
  speech = True,
  use_24hour = False,
  use_ampm = False 
)
Format a time to a comfortable human format
adapted to italian fron en version

For example, generate 'cinque e trenta' for speech or '5:30' for
text display.

Args:
    dt (datetime): date to format (assumes already in local timezone)
    speech (bool): format for speech (default/True) or display (False)=Fal
    use_24hour (bool): output in 24-hour/military or 12-hour format
    use_ampm (bool): include the am/pm for 12-hour format
Returns:
    (str): The formatted time string

Definition at line 397 of file format_it.py.

def mycroft.util.lang.format_it.pronounce_number_it (   num,
  places = 2,
  short_scale = False,
  scientific = False 
)
Convert a number to it's spoken equivalent
adapted to italian fron en version

For example, '5.2' would return 'cinque virgola due'

Args:
    num(float or int): the number to pronounce (under 100)
    places(int): maximum decimal places to speak
    short_scale (bool) : use short (True) or long scale (False)
        https://en.wikipedia.org/wiki/Names_of_large_numbers
    scientific (bool): pronounce in scientific notation
Returns:
    (str): The pronounced number

Definition at line 238 of file format_it.py.

Variable Documentation

dictionary mycroft.util.lang.format_it.FRACTION_STRING_IT
Initial value:
1 = {
2  2: 'mezz',
3  3: 'terz',
4  4: 'quart',
5  5: 'quint',
6  6: 'sest',
7  7: 'settim',
8  8: 'ottav',
9  9: 'non',
10  10: 'decim',
11  11: 'undicesim',
12  12: 'dodicesim',
13  13: 'tredicesim',
14  14: 'quattordicesim',
15  15: 'quindicesim',
16  16: 'sedicesim',
17  17: 'diciassettesim',
18  18: 'diciottesim',
19  19: 'diciannovesim',
20  20: 'ventesim'
21 }

Definition at line 52 of file format_it.py.

mycroft.util.lang.format_it.LONG_SCALE_IT
Initial value:
1 = collections.OrderedDict([
2  (100, 'cento'),
3  (1000, 'mila'),
4  (1000000, 'milioni'),
5  (1e9, "miliardi"),
6  (1e12, "bilioni"),
7  (1e18, 'trilioni'),
8  (1e24, "quadrilioni"),
9  (1e30, "quintilioni"),
10  (1e36, "sestilioni"),
11  (1e42, "settilioni"),
12  (1e48, "ottillioni"),
13  (1e54, "nonillioni"),
14  (1e60, "decemillioni"),
15  (1e66, "undicilione"),
16  (1e72, "dodicilione"),
17  (1e78, "tredicilione"),
18  (1e84, "quattordicilione"),
19  (1e90, "quindicilione"),
20  (1e96, "sedicilione"),
21  (1e102, "diciasettilione"),
22  (1e108, "diciottilione"),
23  (1e114, "dicianovilione"),
24  (1e120, "vintilione"),
25  (1e306, "unquinquagintilione"),
26  (1e312, "duoquinquagintilione"),
27  (1e336, "sesquinquagintilione"),
28  (1e366, "unsexagintilione")
29 ])

Definition at line 75 of file format_it.py.

dictionary mycroft.util.lang.format_it.NUM_STRING_IT
Initial value:
1 = {
2  0: 'zero',
3  1: 'uno',
4  2: 'due',
5  3: 'tre',
6  4: 'quattro',
7  5: 'cinque',
8  6: 'sei',
9  7: 'sette',
10  8: 'otto',
11  9: 'nove',
12  10: 'dieci',
13  11: 'undici',
14  12: 'dodici',
15  13: 'tredici',
16  14: 'quattordici',
17  15: 'quindici',
18  16: 'sedici',
19  17: 'diciassette',
20  18: 'diciotto',
21  19: 'diciannove',
22  20: 'venti',
23  30: 'trenta',
24  40: 'quaranta',
25  50: 'cinquanta',
26  60: 'sessanta',
27  70: 'settanta',
28  80: 'ottanta',
29  90: 'novanta'
30 }

Definition at line 21 of file format_it.py.

mycroft.util.lang.format_it.SHORT_SCALE_IT

Definition at line 106 of file format_it.py.



mycroft_ros
Author(s):
autogenerated on Mon Apr 26 2021 02:35:41