Czech voice navigation optimized for the SVOX TTS engine.
Improved declination and word order of the voice commands.
This commit is contained in:
parent
5f14f137b6
commit
283815cde9
1 changed files with 89 additions and 41 deletions
|
@ -1,3 +1,9 @@
|
|||
% Czech navigation commands optimized for SVOX Classic TTS engine
|
||||
|
||||
% TODO:
|
||||
% maybe use "zahněte" instead of "odbočte"
|
||||
% optimize "pak držte se vlevo" -> "pak se držte vlevo"
|
||||
|
||||
:- op('==', xfy, 500).
|
||||
version(101).
|
||||
language(cs).
|
||||
|
@ -21,63 +27,103 @@ pturn('right', ['vpravo']).
|
|||
pturn('right_sh', ['ostře vpravo']).
|
||||
pturn('right_sl', ['mírně vpravo']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['o', D, 'budete odbočovat', M] :-
|
||||
distance(Dist) == D, pturn(Turn, M).
|
||||
turn(Turn, Dist) == ['o', D, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['po', D, 'budete odbočovat', M] :-
|
||||
distance(Dist,locative) == D, pturn(Turn, M).
|
||||
turn(Turn, Dist) == ['po', D, M] :-
|
||||
distance(Dist,locative) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
prepare_make_ut(Dist) == ['o', D, 'se budete otáčet zpět'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == ['po', D, 'se budete otáčet zpět'] :-
|
||||
distance(Dist,locative) == D.
|
||||
|
||||
prepare_roundabout(Dist) == ['o', D, 'přijedete na kruhový objezd'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_roundabout(Dist) == ['po', D, 'přijedete na kruhový objezd'] :-
|
||||
distance(Dist,locative) == D.
|
||||
|
||||
make_ut(Dist) == ['o', D, 'se otočte zpět'] :-
|
||||
distance(Dist) == D.
|
||||
make_ut(Dist) == ['po', D, 'se otočte zpět'] :-
|
||||
distance(Dist,locative) == D.
|
||||
make_ut == ['otočte se zpět'].
|
||||
|
||||
roundabout(Dist, _Angle, Exit) == ['o', D, 'vjeďte na kruhový objezd', 'a zvolte', E, 'výjezd'] :-
|
||||
distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['jděte cez', E, 'výjezd'] :- nth(Exit, E).
|
||||
roundabout(Dist, _Angle, Exit) == ['po', D, 'vjeďte na kruhový objezd', 'a zvolte', E, 'výjezd'] :-
|
||||
distance(Dist,locative) == D, nth(Exit, nominative, E).
|
||||
roundabout(_Angle, Exit) == ['vyjeďte', E, 'výjezdem'] :- nth(Exit, instrumental, E).
|
||||
|
||||
and_arrive_destination == ['a dorazíte do cíle']. % Miss and?
|
||||
then == ['pak'].
|
||||
reached_destination == ['dorazili jste do cíle'].
|
||||
bear_right == ['držte se vpravo'].
|
||||
bear_left == ['držte se vlevo'].
|
||||
route_recalc(_Dist) == ['přepočítávám']. % nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['cesta je dlouhá', D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
route_recalc(_Dist) == ['přepočítávám']. % nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['cesta je dlouhá', D] :- distance(Dist,accusative) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['pokračujte', D]:- distance(Dist) == D.
|
||||
% SVOX bug workaround - see below
|
||||
go_ahead(Dist) == ['pokračujte', D]:- distance(Dist,workaround) == D.
|
||||
go_ahead == ['pokračujte rovně'].
|
||||
|
||||
%%
|
||||
nth(1, 'první').
|
||||
nth(2, 'druhý').
|
||||
nth(3, 'třetí').
|
||||
nth(4, 'čtvrtý').
|
||||
nth(5, 'pátý').
|
||||
nth(6, 'šestý').
|
||||
nth(7, 'sedmý').
|
||||
nth(8, 'osmý').
|
||||
nth(9, 'devátý').
|
||||
nth(10, 'desátý').
|
||||
nth(11, 'jedenáctý').
|
||||
nth(12, 'dvanáctý').
|
||||
nth(13, 'třináctý').
|
||||
nth(14, 'čtrnáctý').
|
||||
nth(15, 'patnáctý').
|
||||
nth(16, 'šestnáctý').
|
||||
nth(17, 'sedmnáctý').
|
||||
nth(1, nominative, 'první').
|
||||
nth(1, instrumental, 'prvním').
|
||||
nth(2, nominative, 'druhý').
|
||||
nth(2, instrumental, 'druhým').
|
||||
nth(3, nominative, 'třetí').
|
||||
nth(3, instrumental, 'třetím').
|
||||
nth(4, nominative, 'čtvrtý').
|
||||
nth(4, instrumental, 'čtvrtým').
|
||||
nth(5, nominative, 'pátý').
|
||||
nth(5, instrumental, 'pátým').
|
||||
nth(6, nominative, 'šestý').
|
||||
nth(6, instrumental, 'šestým').
|
||||
nth(7, nominative, 'sedmý').
|
||||
nth(7, instrumental, 'sedmým').
|
||||
nth(8, nominative, 'osmý').
|
||||
nth(8, instrumental, 'osmým').
|
||||
nth(9, nominative, 'devátý').
|
||||
nth(9, instrumental, 'devátým').
|
||||
nth(10, nominative, 'desátý').
|
||||
nth(10, instrumental, 'desátým').
|
||||
nth(11, nominative, 'jedenáctý').
|
||||
nth(11, instrumental, 'jedenáctým').
|
||||
nth(12, nominative, 'dvanáctý').
|
||||
nth(12, instrumental, 'dvanáctým').
|
||||
nth(13, nominative, 'třináctý').
|
||||
nth(13, instrumental, 'třináctým').
|
||||
nth(14, nominative, 'čtrnáctý').
|
||||
nth(14, instrumental, 'čtrnáctým').
|
||||
nth(15, nominative, 'patnáctý').
|
||||
nth(15, instrumental, 'patnáctým').
|
||||
nth(16, nominative, 'šestnáctý').
|
||||
nth(16, instrumental, 'šestnáctým').
|
||||
nth(17, nominative, 'sedmnáctý').
|
||||
nth(17, instrumental, 'sedmnáctým').
|
||||
|
||||
%%% distance measure
|
||||
distance(Dist) == [ X, 'metrů'] :- Dist < 100, D is round(Dist/10)*10, num_atom(D, X).
|
||||
distance(Dist) == [ X, 'metrů'] :- Dist < 1000, D is round(2*Dist/100)*50, num_atom(D, X).
|
||||
distance(Dist) == ['přibližně jeden kilometr'] :- Dist < 1500.
|
||||
distance(Dist) == ['přibližně', X, 'kilometry'] :- Dist < 4500, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist) == ['přibližně', X, 'kilometrů'] :- Dist < 10000, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist) == [ X, 'kilometrů'] :- D is round(Dist/1000), num_atom(D, X).
|
||||
%%% distance measure - accusative
|
||||
% workaround of wrong declination in SVOX
|
||||
% example: "pokracujte pet metru"
|
||||
% SVOX bug: without "dál" says "pokračujte osmdesáti metrů" instead of "pokračujte osmdesát metrů"
|
||||
% "pokračujte rovně 80 metrů" does not work either
|
||||
% SVOX bug: "pokracujte dal priblizne 3 kilometry" is pronounced as "pokracujte dal priblizne tremi kilometry"
|
||||
distance(Dist,workaround) == [ 'dál', X, 'metrů'] :- Dist < 100, D is round(Dist/10)*10, num_atom(D, X).
|
||||
distance(Dist,workaround) == [ 'dál', X, 'metrů'] :- Dist < 1000, D is round(2*Dist/100)*50, num_atom(D, X).
|
||||
distance(Dist,workaround) == ['přibližně jeden kilometr'] :- Dist < 1500.
|
||||
distance(Dist,workaround) == ['přibližně', X, 'kilometry'] :- Dist < 4500, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist,workaround) == ['dál přibližně', X, 'kilometrů'] :- Dist < 10000, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist,workaround) == [ 'dál', X, 'kilometrů'] :- D is round(Dist/1000), num_atom(D, X).
|
||||
|
||||
%%% distance measure - accusative
|
||||
% example: "pokracujte pet metru"
|
||||
distance(Dist,accusative) == [ X, 'metrů'] :- Dist < 100, D is round(Dist/10)*10, num_atom(D, X).
|
||||
distance(Dist,accusative) == [ X, 'metrů'] :- Dist < 1000, D is round(2*Dist/100)*50, num_atom(D, X).
|
||||
distance(Dist,accusative) == ['přibližně jeden kilometr'] :- Dist < 1500.
|
||||
distance(Dist,accusative) == ['přibližně', X, 'kilometry'] :- Dist < 4500, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist,accusative) == ['přibližně', X, 'kilometrů'] :- Dist < 10000, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist,accusative) == [ X, 'kilometrů'] :- D is round(Dist/1000), num_atom(D, X).
|
||||
|
||||
%%% distance measure - locative
|
||||
% example: "po peti metrech zabocte vpravo"
|
||||
distance(Dist,locative) == [ X, 'metrech'] :- Dist < 100, D is round(Dist/10)*10, num_atom(D, X).
|
||||
distance(Dist,locative) == [ X, 'metrech'] :- Dist < 1000, D is round(2*Dist/100)*50, num_atom(D, X).
|
||||
distance(Dist,locative) == ['přibližně jednom kilometru'] :- Dist < 1500.
|
||||
distance(Dist,locative) == ['přibližně', X, 'kilometrech'] :- Dist < 10000, D is round(Dist/1000), num_atom(D, X).
|
||||
distance(Dist,locative) == [ X, 'kilometrech'] :- D is round(Dist/1000), num_atom(D, X).
|
||||
|
||||
%% resolve command main method
|
||||
%% if you are familar with Prolog you can input specific to the whole mechanism,
|
||||
|
@ -85,9 +131,11 @@ distance(Dist) == [ X, 'kilometrů'] :- D is round(Dist/1000), num_atom(D, X).
|
|||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
resolve_impl([],[]).
|
||||
resolve_impl([X|Rest], List) :- resolve_impl(Rest, Tail), ((X == L) -> append(L, Tail, List); List = Tail).
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue