Abbreviations, automatic: Difference between revisions
Content deleted Content added
Added Prolog Solution |
m Prolog code changed to handle mixed case |
||
Line 2,563: | Line 2,563: | ||
L2 is L1 + 1, |
L2 is L1 + 1, |
||
common_prefix_length1(Chars1, Chars2, Length, L2). |
common_prefix_length1(Chars1, Chars2, Length, L2). |
||
to_upper_case([], []):-!. |
|||
to_upper_case([String|S], [Upper_case|U]):- |
|||
string_upper(String, Upper_case), |
|||
to_upper_case(S, U). |
|||
process_line(""):- |
process_line(""):- |
||
Line 2,569: | Line 2,574: | ||
process_line(Line):- |
process_line(Line):- |
||
split_string(Line, "\s\t", "\s\t", Day_names), |
split_string(Line, "\s\t", "\s\t", Day_names), |
||
to_upper_case(Day_names, Upper), |
|||
minimum_abbreviation_length(Upper, Length), |
|||
writef('%w %w\n', [Length, Line]). |
writef('%w %w\n', [Length, Line]). |
||
Line 2,653: | Line 2,659: | ||
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota |
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota |
||
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado |
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado |
||
2 Domingo Lunes martes Miercoles Jueves Viernes Sabado |
|||
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª |
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª |
||
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota |
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota |