You are not logged in.

#1 2010-12-05 21:25:47

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

FuzzyTime

EDIT: looking for anyone wishing to help me with translations (no programming knowledge required)

EDIT:
(v0.6+) now with timer mode:
Example use: Say you have fuzzytime piped to your status bar and it serves as a usual clock applet. Then you got an e-mail saying that you're going to have a meeting at one o'clock. You set the timer to 13:00 and instead of the current time, fuzzytime begins to show you how much time you have left till the meeting. After you come back, you unset the timer and have fuzzytime display the current time again.


Hello smile

The now-not-so-recent upgrade to Python 3 broke fuzzyclock which I liked a lot. Since my Python is next to non-existent, I decided to use the opportunity to dust off the little Haskell I knew, so here goes:

A clock and timer that tell the time in a more human way.
v0.7.6, 2011.12.30, *antispam*, GPL3+

fuzzytime [COMMAND] ... [OPTIONS]

Common flags:
  -? --help        Display help message
  -V --version     Print version information

fuzzytime clock [OPTIONS]
  Print fuzzy time if timer is not set, and countdown if it is.

  -a --caps=INT    Capital letters; default 1 (see the man page).
  -c --clock=INT   12 or 24-hour clock; default 12-hour.
  -l --lang=ITEM   Language (currently da, de, el, en, es, fr, it, ja, nb,
                   nl, pl, se and tr); default en.
  -p --prec=INT    Precision (1 <= prec <= 60 [minutes]); default 5.
  -t --time=ITEM   Time to fuzzify as HH:MM; default current time.
  -o --sound=ITEM  Command to play the alarm sound; see man for the default.
  -s --style=INT   How the time is told (see the man page); default 1.

fuzzytime timer [OPTIONS] [END]
  Set timer to END as HH:MM or "unset". (Disables printing time.)

You can get the source from here. It requires runhaskell (e.g. ghc) and haskell-cmdargs. An AUR package is here. [edit: added aur link]

WARNING: it's not properly tested so if you're late for anything, don't blame me. You can tell me, though, and make me feel guilty if you like.
If you find any bugs, please let me know.

Currently, only two languages are supported: English and Polish. If you're willing to add another one or would just like to have another one but don't know how to or don't feel like doing it, please contact me.

Happy timing smile

EDIT:
v0.7.6 (2011.12.30)
-- added Japanese (by Jens Petersen)
v0.7.5 (2011.11.28)
-- added alarm sound config
v0.7.4 (2011.04.26)
-- added Italian (thanks erm67)
v0.7.3 (2011.04.22)
-- added Swedish (thanks Closey)
v0.7.2 (2011.04.17)
-- added --caps (0: all lowercase; 1: default; 2: Title Case; 3: ALL CAPS)
v0.7 (2011.01.24)
-- added Norwegian (thanks arnvidr)
-- added timer for Dutch (thanks Boris27) and German (thanks marens and ichbinsisyphos)
-- added Danish style 2
-- added German style 3 (thanks marens and ichbinsisyphos)
-- added Spanish style 3 (thanks xenofungus)
-- added timer alarm sound
-- fixed exit codes
v0.6 (2011.01.21)
-- added the timer mode (en, fr, pl and tr)
-- added Spanish (thanks itsbrad212)
-- fixed the almost-next-hour bug
v0.5 (2011.01.17)
-- added halves as base (de, nl and pl)
-- added Greek (thanks Gbak), Dutch (thanks litemotiv) and Turkish
-- some corrections (thanks D. Fischer from beginners@haskell.org again)
v0.4.1 (2011.01.15)
-- fixed nextFTHour
v0.4 (2011.01.15):
-- added --time (thanks D. Fischer and B. Yorgey from beginners@haskell.org)
-- added --style
-- added Danish (by M_ller with my modifications)
-- removed "południe" from pl
-- sorted out the representation of midnight and noon
-- added a man page
v0.3 (2011.01.14):
-- added midnight and noon
-- added checking cli options
-- fixed the "quarter part quarter" bug
v0.2 (2011.01.12):
-- added French and German
-- added 12 vs. 24-hour clock

Last edited by caminoix (2011-12-30 22:05:00)

Offline

#2 2010-12-06 06:56:16

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: FuzzyTime

caminoix wrote:

The now-not-so-recent upgrade to Python 3 broke fuzzyclock

Ehmm... no it didn't. fuzzyclock works just fine with python2.

Nice work though. smile

Offline

#3 2010-12-06 07:42:02

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

tomk wrote:

Ehmm... no it didn't. fuzzyclock works just fine with python2.

Does it? Oops... Erm... Well... So there are two now smile

Offline

#4 2010-12-11 12:24:23

moetunes
Member
From: A comfortable couch
Registered: 2010-10-09
Posts: 1,033

Re: FuzzyTime

I wanted a fuzzy clock to show in conky so I knocked one up in C, I didn't know there was a python one (could've saved me some work)...


You're just jealous because the voices only talk to me.

Offline

#5 2011-01-14 00:10:33

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Bump: looking for anyone wishing to help me with translations (no programming knowledge required).

Offline

#6 2011-01-14 02:25:50

tomd123
Developer
Registered: 2008-08-12
Posts: 565

Re: FuzzyTime

Hey caminoix, thanks for a great utility!

Offline

#7 2011-01-14 20:48:49

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

I'm very happy that you like it smile
Have you managed to install it after all? I can see in aur that you had some problems?

Offline

#8 2011-01-14 21:24:15

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

Re: FuzzyTime

I could help you out translating it to Danish if you want.

Offline

#9 2011-01-14 21:31:32

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

M_ller wrote:

I could help you out translating it to Danish if you want.

Wonderful!

I suppose what I'm going to need is:

1. the desired casual "names" for the following hours: 23:30, 23:45, 00:00, 00:15, 11:30, 11:45, 12:00, 12:15, 22:00, 22:10, 22:15, 22:25, 22:30, 22:35, 22:45, unless there are any other "special" hours in Danish, i.e. ones that would not get properly rendered by an algorithm covering the above?

2. if possible, you to check the results once they are ready. Unfortunately, I do not know Danish and couldn't be sure when doing it myself.

Thank you for your help!

EDIT: I just realized that you might be actually wanting to implement it yourself. In such case just drop me a line whenever you're not sure why I did something the way I did, or want to bash me for my programming ignorance smile Unless you want to fork, I'll be very happy to incorporate your code if you agree.

Last edited by caminoix (2011-01-14 21:34:51)

Offline

#10 2011-01-14 21:40:17

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

Re: FuzzyTime

caminoix wrote:
M_ller wrote:

I could help you out translating it to Danish if you want.

Wonderful!

I suppose what I'm going to need is:

1. the desired casual "names" for the following hours: 23:30, 23:45, 00:00, 00:15, 11:30, 11:45, 12:00, 12:15, 22:00, 22:10, 22:15, 22:25, 22:30, 22:35, 22:45, unless there are any other "special" hours in Danish, i.e. ones that would not get properly rendered by an algorithm covering the above?

2. if possible, you to check the results once they are ready. Unfortunately, I do not know Danish and couldn't be sure when doing it myself.

Thank you for your help!

EDIT: I just realized that you might be actually wanting to implement it yourself. In such case just drop me a line whenever you're not sure why I did something the way I did, or want to bash me for my programming ignorance smile Unless you want to fork, I'll be very happy to incorporate your code if you agree.

I have edited your source (fuzzytime.hs) and here is the result.

showFuzzyTimeDa :: FuzzyTime -> String
showFuzzyTimeDa (FuzzyTime am clock hour _ min)
| min == 0 = if (getHour hour) `elem` ["midnat", "aften"] then (getHour hour) else (getHour hour) ++ " klokken" -- We don't really use anything. You could remove " klokken"
| min <= 30 = getMin min ++ " over " ++ getHour hour
| min > 30 = getMin (60-min) ++ " i " ++ getHour (hour+1)
| otherwise = "Ups, det ser ud til den er " ++ show hour ++ ":" ++ show min ++ "."
where
getHour :: Int -> String
getHour h
| h == 0 && am = "midnat"
| h == 0 && not am = if clock==12 then "aften" else "midnat"
| h == 12 = "aften"
| otherwise = numeralDa h
getMin :: Int -> String
getMin m
| m == 30 = "halv" -- You should note that we don't say "half past 2" when it's 14:30. We say "It's half 3".
| m `elem` [15, 45] = "kvarter"
| otherwise = numeralDa m


numeralDa :: Int -> String
numeralDa n
| n < 20 = numeralDaHelper1 n
| n `mod` 10 == 0 = numeralDaHelper10 (n `div` 10)
| otherwise = numeralDaHelper10 (n `div` 10) ++ "-" ++ numeralEnHelper1 (n `mod` 10)
where
numeralDaHelper1 :: Int -> String
numeralDaHelper1 i = ["nul", "et", "to", "tre", "fire", "fem", "seks", "syv", "otte", "ni", "ti", "eleve", "tolv", "tretten", "fjorten", "femten", "seksten", "sytten", "atten", "nitten"] !! i
numeralDaHelper10 :: Int -> String
numeralDaHelper10 i = ["tyve", "tredive", "fyrre", "halvtreds"] !! (i-2)

23:30 - Halv tolv          (perhaps fireogtyve instead of tolv)
23:45 - Kvart i tolv       (perhaps fireogtyve instead of tolv)
00:00 - Tolv                  (perhaps fireogtyve instead of tolv)
00:15 - Kvart over tolv (perhaps fireogtyve instead of tolv)
11:30 - Halv tolv
11:45 - Kvart i tolv
12:00 - Tolv
12:15 - Kvart over tolv
22:00 - Toogtyve
22:10 - Ti over toogtyve
22:15 - Kvart over toogtyve
22:25 - Femogtyve over toogtyve
22:30 - Halv treogtyve
22:35 - Femogtyve i treogtyve
22:45 - Kvart i treogtyve

It's quite confusing 'cause we usually use "tolv" for both 12:00 and 24:00 (and eleve for 11:00 and 23:00 and so on), but to be correct, you should probably stick with tolv for 12 and fireogtyve for 24.

Last edited by M_ller (2011-01-14 21:41:22)

Offline

#11 2011-01-14 21:44:18

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Wow, that was fast!
I've made a few modifications in the meantime, so I'll update your code and post it for testing.

Offline

#12 2011-01-15 11:31:32

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

I've uploaded a new version to AUR, ready for testing. There are quite a few changes but the two most notable ones are the addition of --time (makes testing much easier) and --style.

@M_ller
I've made some modifications to your code, mostly basing on your comments and the number of hits in Google for certain phrases. It would be great if you could take a look at it, please (see the script below), and tell me whether this matches how Danish people really speak in casual situations.

A testing script:

#!/bin/bash

function testMidnight {
    for i in "23:30" "23:45" "00:00" "00:15" "11:30" "11:45" "12:00" "12:15"; do
        echo $i" "`fuzzytime "$clock" "$lang" "$prec" -t$i "$style"`
    done
}

lang="-lda"; prec="-p5"; 

echo "Style 1"
clock="-c12"; style="-s1"; testMidnight
echo
clock="-c24"; style="-s1"; testMidnight
echo
echo
echo "Style 2"
clock="-c12"; style="-s2"; testMidnight
echo
clock="-c24"; style="-s2"; testMidnight

Offline

#13 2011-01-15 13:45:39

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

Re: FuzzyTime

I just installed it (damn that Haskell was a big package/install) and I will test it out at certain times.
It does work nicely at the moment ("tyve i tre" = twenty to three), so nice job.

It is nice with the feature of 12 or 24-hour clock, since, as I described before, we usually don't say the numbers above 12, even though it's nice (etc. 18, we say 6 (seks)).

I think it is working perfectly. When using the 12-hour clock, it is exactly like we would say.

Offline

#14 2011-01-16 08:14:22

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Great to hear that, M_ller smile If you ever notice a problem, though, please drop me a line. Thanks for your work!

Offline

#15 2011-01-16 09:53:33

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: FuzzyTime

Dutch:

23:30 - Half twaalf
23:45 - Kwart voor twaalf
00:00 - Middernacht (all other use 'twaalf', whether it's noon or midnight)
00:15 - Kwart over twaalf
11:30 - Half twaalf
11:45 - Kwart voor twaalf
12:00 - Twaalf uur
12:15 - Kwart over twaalf
22:00 - Tien uur
22:10 - Tien over tien
22:20 - Twintig over tien
22:25 - Vijf voor half elf
22:35 - Vijf over half elf
22:40 - Tien over half elf (or, Twintig voor elf, first form preferred)

een / twee / drie / vier / vijf / zes / zeven / acht / negen / tien / elf / twaalf / 15: kwart / 20: twintig


ᶘ ᵒᴥᵒᶅ

Offline

#16 2011-01-16 11:47:31

DeletedUser201201
Banned
Registered: 2010-02-27
Posts: 73

Re: FuzzyTime

23:30 - Εντεκάμιση or "Έντεκα και μισή"
23:45 - Δώδεκα παρά τέταρο
00:00 - Δώδεκα
00:15 - Δώδεκα και τέταρτο
11:30 - Εντεκάμιση or "Έντεκα και μισή"
11:45 - Δώδεκα παρά τέταρο
12:00 - Δώδεκα
12:15 - Δώδεκα και τέταρτο
22:00 - Δέκα
22:10 - Δέκα και δέκα
22:15 - Δέκα και τέταρτο
22:25 - Δέκα και είκοσιπέντε
22:30 - Δέκα και μισή
22:35 - Δέκα και τριανταπέντε
22:45 - Έντεκα παρά τέταρτο

Translated in Greek

Offline

#17 2011-01-16 18:12:43

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Wonderful, thanks, guys! I'll try to do it in a reasonable time and I'll come back when I'm ready.

Offline

#18 2011-01-17 21:51:01

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Uploaded a new version.

(Chronologically) M_ller, litemotiv and Gbak, can you please take a look? The actual outputs are one thing, but please also see the man page where I described some decisions I made basing on what you said and the number of hits in Google for certain phrases. I'd be grateful for a confirmation or corrections.

There's a new version of the testing script here.

Offline

#19 2011-01-17 22:51:52

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: FuzzyTime

I can do Spanish translations if you would like. Do you want something such as "it is twelve-thirty" or just "twelve-thirty"? smile

Offline

#20 2011-01-18 12:48:43

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

That is great, itsbrad212, thank you!

(The post looks long and complicated, but don't worry, it's not, it's just words, words, words smile

If that's possible, I'd like two versions: 1. a simple "ten past six", "ten to six", 2. a more elaborate one, using words like "midnight" and "noon", constructions like (literally) "five past half past six" and similar – obviously, only if such things are actually in common use.

Basically, the point is to obtain the kind of wording that you'd expect from a human if you asked him or her what time it is, in a slightly more "digital" and a slightly more human version. Pretty much what the guys above have done. So if you e.g. use the word for 'midnight' for telling the time but don't use 'noon', that's just fine.

If what I said is not clear, please take a look at the table in the man page. If that doesn't help, I'll try to explain it some other way.

Additionally, I'm considering adding a countdown timer to remind you when to stop boiling the eggs, leave for the meeting or something. For this, I'm going to need translations for the following phrases:
– in an hour + an hour ago
– in three quarters (if actually used) + three quarters ago
– in half an hour + half an hour ago
– in a minute + a minute ago

+

whatever comes to your mind and you think it would be useful, funny or desired in any other way.

Offline

#21 2011-01-18 23:39:25

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: FuzzyTime

23:30 - Son las once y media de la noche (It's eleven and a half in the evening)
23:45 - Es la medianoche menos quince (It's fifteen before midnight)
00:00 - Es la medianoche (It's midnight)
00:15 - Es la medianoche y cuarto (It's a quarter past midnight)
11:30 - Son las once y media de la mañana (It's eleven and a half in the morning)
11:45 - Son las mediodía menos quince (It's fifteen before noon)
12:00 - Son las mediodía (It's noon)
12:15 - Son las doce y cuarto de la tarde (It's twelve and a quarter in the afternoon)
22:00 - Son las diez de la noche (It's ten in the evening)
22:10 - Son las diez y diez de la noche (It's ten past ten in the evening)
22:15 - Son las diez y cuarto de la noche (It's a quarter past ten in the evening)
22:25 - Son las diez y veinticinco de la noche (It's ten twenty-five in the evening)
22:30 - Son las diez y media de la noche (It's ten and a half in the evening)
22:35 - Son las once menos veinticinco de la noche (It's twenty-five before eleven in the evening)
22:45 - Son las once menos quince de la noche (It's fifteen before eleven in the evening)

There you are. smile I may have mistyped a few things here or there, but it all looks correct to me.

Last edited by cesura (2011-01-18 23:41:04)

Offline

#22 2011-01-20 09:51:54

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Great, thanks!

Offline

#23 2011-01-21 14:08:16

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

Version 0.6 is out.

I added Spanish, so itsbrad212, it will be great if you can take a look at it.

I also added a timer mode so besides showing the time, fuzzytime can now also remind you how much time you have left till something. More details in --help, in the man page and here.

Offline

#24 2011-01-21 14:48:01

xenofungus
Member
From: Spain
Registered: 2009-10-17
Posts: 63

Re: FuzzyTime

itsbrad212 wrote:

23:30 - Son las once y media de la noche (It's eleven and a half in the evening)
23:45 - Es la medianoche menos quince (It's fifteen before midnight)
00:00 - Es la medianoche (It's midnight)
00:15 - Es la medianoche y cuarto (It's a quarter past midnight)
11:30 - Son las once y media de la mañana (It's eleven and a half in the morning)
11:45 - Son las mediodía menos quince (It's fifteen before noon)
12:00 - Son las mediodía (It's noon)
12:15 - Son las doce y cuarto de la tarde (It's twelve and a quarter in the afternoon)
22:00 - Son las diez de la noche (It's ten in the evening)
22:10 - Son las diez y diez de la noche (It's ten past ten in the evening)
22:15 - Son las diez y cuarto de la noche (It's a quarter past ten in the evening)
22:25 - Son las diez y veinticinco de la noche (It's ten twenty-five in the evening)
22:30 - Son las diez y media de la noche (It's ten and a half in the evening)
22:35 - Son las once menos veinticinco de la noche (It's twenty-five before eleven in the evening)
22:45 - Son las once menos quince de la noche (It's fifteen before eleven in the evening)

There you are. smile I may have mistyped a few things here or there, but it all looks correct to me.

Don't know about south-central-american spanish, but in spanish from spain this sounds more natural:


23:30 - Son las once y media de la noche.
23:45 - Son las doce menos cuarto de la noche.
00:00 - Es medianoche.
00:15 - Son las doce y cuarto de la noche.
11:30 - Son las once y media de la mañana.
11:45 - Son doce menos cuarto de la mañana.
12:00 - Es mediodía.
12:15 - Son las doce y cuarto de la tarde.
22:00 - Son las diez de la noche.
22:10 - Son las diez y diez de la noche.
22:15 - Son las diez y cuarto de la noche.
22:25 - Son las diez y veinticinco de la noche.
22:30 - Son las diez y media de la noche.
22:35 - Son las once menos veinticinco de la noche.
22:45 - Son las once menos cuarto de la noche.

01:15 - Es la una y cuarto de la mañana.
13:30 - Es la una y media de la tarde.

Offline

#25 2011-01-21 19:52:26

caminoix
Member
From: cracow, poland
Registered: 2005-07-12
Posts: 162
Website

Re: FuzzyTime

@xenofungus
Thank you for the translation! As far as the differences between Spanish in Spain and in the Americas are concerned, well, all I can do is to believe native speakers. In fact, I'm from Europe, so I guess I have a bias for the Spanish Spanish anyway smile but I can see no reason why there shouldn't be two or more separate "Spanishes" available. I just need exact information.

From what you wrote, I can see the difference is mainly in the use of medianoche and medodía. If you can, please install fuzzytime and tell me whether what it produces sounds wrong to you (you can specify the time with -tHH:MM, and there are some differences between -s1 (default) and -s2).

Also, is the es/son and de la mañana/tarde/noche really used in a casual conversation? If you asked a friend what time it is, would you expect to hear either of these?

Offline

Board footer

Powered by FluxBB