new unlexers ; work on Romance

This commit is contained in:
aarne
2005-03-31 14:47:42 +00:00
parent f3b9774062
commit e549dd79bc
11 changed files with 236 additions and 79 deletions

View File

@@ -8,18 +8,18 @@ flags
lin
airplane_N = regN "aereo" ;
--V answer_V2S = mkV2S (v2V répondre_V2) dative ;
answer_V2S = mkV2S (verboV (rispondere_76 "rispondere")) dative ;
apartment_N = regN "apartamento" ;
apple_N = regN "mela" ;
art_N = femN (regN "arte") ;
--V ask_V2Q = mkV2Q (regV "demander") dative ;
ask_V2Q = mkV2Q (verboV (rispondere_76 "chiedere")) dative ;
baby_N = regN "bambino" ;
bad_ADeg = prefADeg (mkADeg (regA "cattivo") (regA "peggio")) ;
bank_N = regN "banca" ;
beautiful_ADeg = prefADeg (regADeg "bello") ;
become_VA = essereV (regV "diventare") ;
beer_N = regN "birra" ;
--V beg_V2V = mkV2V (regV "demander") accusative dative ;
beg_V2V = mkV2V (regV "pregare") accusative dative ;
big_ADeg = prefADeg (regADeg "grande") ;
bike_N = regN "bicicletta" ;
bird_N = regN "uccello" ;
@@ -31,7 +31,7 @@ lin
boss_N = regN "capo" ;
boy_N = regN "ragazzo" ;
bread_N = regN "pane" ;
--V break_V2 = dirV2 (regV "casser") ;
break_V2 = dirV2 (verboV (rompere_77 "rompere")) ;
broad_ADeg = regADeg "largo" ;
brother_N2 = diN2 (regN "fratello") ;
brown_ADeg = regADeg "marrone" ;
@@ -50,26 +50,26 @@ lin
city_N = regN "città" ;
clean_ADeg = regADeg "proprio" ;
clever_ADeg = regADeg "saggio" ;
--V close_V2 = dirV2 (regV "") ;
--V coat_N = regN "manteau" ;
close_V2 = dirV2 (verboV (chiudere_30 "chiudere")) ;
coat_N = regN "cappotto" ;
cold_ADeg = regADeg "freddo" ;
--V come_V = venir_V ;
come_V = essereV (verboV (venire_110 "venire")) ;
computer_N = regN "computer" ;
country_N = regN "paese" ;
cousin_N = regN "cugino" ; --- cousine
cow_N = regN "vacca" ;
--V die_V = mourir_V ;
die_V = verboV (morire_105 "morire") ;
dirty_ADeg = regADeg "sporco" ;
doctor_N = mkN "medico" "medici" masculine ;
dog_N = regN "cane" ;
door_N = regN "porta" ;
--V drink_V2 = boire_V2 ;
drink_V2 = dirV2 (verboV (bere_27 "bere")) ;
easy_A2V = mkA2V (regA "facile") dative genitive ;
eat_V2 = dirV2 (regV "mangiare") ;
--V enemy_N = regN "ennemi" ;
enemy_N = regN "nemico" ;
factory_N = regN "stabilimento" ;
father_N2 = diN2 (regN "padre") ;
--V fear_VS = mkVS (v2V craindre_V2) ;
fear_VS = mkVS (verboV (temere_20 "temere")) ;
find_V2 = dirV2 (regV "trovare") ;
fish_N = regN "pesca" ;
floor_N = regN "pavimento" ;
@@ -84,13 +84,13 @@ lin
gold_N = regN "oro" ;
good_ADeg = prefADeg (mkADeg (regA "buono")
(mkA "migliore" "migliore" "migliori" "migliori" "meglio")) ;
--V go_V = aller_V ;
go_V = essereV (verboV (andare_14 "andare")) ;
green_ADeg = regADeg "verde" ;
harbour_N = regN "porto" ;
--V hate_V2 = haïr_V2 ;
hate_V2 = dirV2 (regV "odiare") ;
hat_N = regN "capello" ;
--V have_V2 = avoir_V2 ;
--V hear_V2 = entendre_V2 ;
have_V2 = dirV2 (verboV (avere_2 "avere")) ;
hear_V2 = dirV2 (verboV (sentire_99 "sentire")) ;
hill_N = regN "collina" ;
hope_VS = mkVS (regV "sperare") ;
horse_N = regN "cavallo" ;
@@ -100,17 +100,17 @@ lin
industry_N = regN "industria" ;
iron_N = regN "ferro" ;
king_N = regN "ré" ;
--V know_V2 = connaître_V2 ; --- savoir_V2 : VS
know_V2 = dirV2 (verboV (conoscere_37 "conoscere")) ; --- savoir_V2 : VS
lake_N = regN "lago" ;
lamp_N = regN "lampa" ;
--V learn_V2 = apprendre_V2 ;
learn_V2 = dirV2 (regV "imparare") ;
leather_N = regN "cuoio" ;
leave_V2 = dirV2 (regV "lasciare") ;
like_V2 = dirV2 (regV "amare") ;
listen_V2 = dirV2 (regV "ascoltare") ;
--V live_V = v2V vivre_V2 ;
live_V = verboV (vivere_95 "vivere") ;
long_ADeg = regADeg "lungo" ;
--V lose_V2 = perdre_V2 ;
lose_V2 = dirV2 (verboV (perdere_62 "perdere")) ;
love_N = regN "amore" ;
love_V2 = dirV2 (regV "amare") ;
man_N = regN "uomo" ;
@@ -125,10 +125,9 @@ lin
new_ADeg = prefADeg (regADeg "nuovo") ;
newspaper_N = regN "giornale" ;
oil_N = regN "olio" ;
old_ADeg =
prefADeg (regADeg "vecchio") ; ---- vieil
--V open_V2 = ouvrir_V2 ;
--V paint_V2A = mkV2A (v2V peindre_V2) accusative ;
old_ADeg = prefADeg (regADeg "vecchio") ;
open_V2 = dirV2 (verboV (aprire_102 "aprire")) ;
paint_V2A = mkV2A (verboV (cingere_31 "pingere")) accusative ;
paper_N = regN "carta" ;
peace_N = femN (regN "pace") ;
pen_N = regN "penna" ;
@@ -140,8 +139,8 @@ lin
probable_AS = mkAS (regA "probabile") ;
queen_N = regN "regina" ;
radio_N = mkN "radio" "radio" feminine ;
--V rain_V0 = mkV0 (pleuvoir_V) ;
--V read_V2 = lire_V2 ;
rain_V0 = mkV0 (verboV (piovere_66 "piovere")) ;
read_V2 = dirV2 (verboV (leggere_56 "leggere")) ;
red_ADeg = regADeg "rosso" ;
religion_N = femN (regN "religione") ;
restaurant_N = regN "ristorante" ;
@@ -149,16 +148,16 @@ lin
rock_N = regN "roccia" ;
roof_N = regN "tetto" ;
rubber_N = regN "gomma" ;
--V run_V = v2V courir_V2 ;
--V say_VS = mkVS (v2V dire_V2) ;
run_V = verboV (correre_38 "correre") ;
say_VS = mkVS (verboV (dire_41 "dire")) ;
school_N = regN "scuola" ;
science_N = regN "scienza" ;
sea_N = regN "mare" ;
seek_V2 = dirV2 (regV "cercare") ;
--V see_V2 = voir_V2 ;
--V sell_V3 = dirV3 (v2V vendre_V2) dative ;
see_V2 = dirV2 (verboV (vedere_93 "vedere")) ;
sell_V3 = dirV3 (verboV (scendere_80 "vendere")) dative ; ---- except some forms
send_V3 = dirV3 (regV "mandare") dative ;
--V sheep_N = regN "mouton" ;
sheep_N = regN "agnello" ;
ship_N = femN (regN "nave") ;
shirt_N = regN "camicia" ;
shoe_N = regN "scarpa" ;
@@ -166,10 +165,10 @@ lin
short_ADeg = regADeg "corto" ; --- breve
silver_N = regN "argento" ;
sister_N = regN "sorella" ;
--V sleep_V = v2V dormir_V2 ;
sleep_V = verboV (dormire_99b "dormire") ;
small_ADeg = prefADeg (regADeg "piccolo") ;
--V snake_N = regN "serpent" ;
--V sock_N = regN "chaussette" ;
snake_N = regN "serpente" ;
sock_N = regN "calza" ;
speak_V2 = dirV2 (regV "parlare") ;
star_N = regN "stella" ;
steel_N = regN "acciaio" ;
@@ -178,7 +177,7 @@ lin
student_N = regN "studente" ;
stupid_ADeg = regADeg "stupido" ;
sun_N = regN "sole" ;
--V switch8off_V2 = éteindre_V2 ;
switch8off_V2 = dirV2 (verboV (cingere_31 "spingere")) ;
switch8on_V2 = dirV2 (regV "allumare") ; ----
table_N = regN "tavola" ; --- tavolo
talk_V3 = mkV3 (regV "parlare") dative genitive ;
@@ -204,21 +203,21 @@ lin
white_ADeg = compADeg (regA "bianco") ;
window_N = regN "finestra" ;
wine_N = regN "vino" ;
--V win_V2 = dirV2 (vincere) ;
win_V2 = dirV2 (verboV (vincere_94 "vincere")) ;
woman_N = regN "donna" ;
wonder_VQ = mkVQ (regV "domandare") ; ---- domandarsi
wood_N = regN "legno" ;
--V write_V2 = écrire_V2 ;
write_V2 = dirV2 (verboV (scrivere_82 "scrivere")) ;
yellow_ADeg = regADeg "giallo" ;
young_ADeg = prefADeg (regADeg "giovane") ;
--V do_V2 = faire_V2 ;
do_V2 = dirV2 (verboV (fare_52 "fare")) ;
now_Adv = mkAdv "adesso" ;
already_Adv = mkAdv "già" ;
song_N = femN (regN "canzone") ;
--V add_V3 = dirV3 (regV "ajouter") dative ;
add_V3 = dirV3 (verboV (giungere_55 "aggiungere")) dative ;
number_N = regN "numero" ;
--V put_V2 = mettre_V2 ;
put_V2 = dirV2 (verboV (mettere_57 "mettere")) ;
stop_V = regV "fermare" ; ---- fermarsi
jump_V = regV "saltare" ;
here_Adv = mkAdv "quì" ;

View File

@@ -6148,7 +6148,69 @@ oper finire_100 : Str -> Verbo = \finire ->
} ;
---- apparire_101
---- aprire_102
oper aprire_102 : Str -> Verbo = \aprire ->
let ap_ = Predef.tk 4 aprire in
{s = table {
Inf => ap_ + "rire" ;
InfClit => ap_ + "rir" ;
Indi Pres Sg P1 => ap_ + "ro" ;
Indi Pres Sg P2 => ap_ + "ri" ;
Indi Pres Sg P3 => ap_ + "re" ;
Indi Pres Pl P1 => ap_ + "riamo" ;
Indi Pres Pl P2 => ap_ + "rite" ;
Indi Pres Pl P3 => ap_ + "rono" ;
Indi Imperf Sg P1 => ap_ + "rivo" ;
Indi Imperf Sg P2 => ap_ + "rivi" ;
Indi Imperf Sg P3 => ap_ + "riva" ;
Indi Imperf Pl P1 => ap_ + "rivamo" ;
Indi Imperf Pl P2 => ap_ + "rivate" ;
Indi Imperf Pl P3 => ap_ + "rivano" ;
Pass Sg P1 => variants {ap_ + "rii" ; ap_ + "ersi"} ;
Pass Sg P2 => ap_ + "risti" ;
Pass Sg P3 => variants {ap_ + "rì" ; ap_ + "erse"} ;
Pass Pl P1 => ap_ + "rimmo" ;
Pass Pl P2 => ap_ + "riste" ;
Pass Pl P3 => variants {ap_ + "rirono" ; ap_ + "ersero"} ;
Fut Sg P1 => ap_ + "rirò" ;
Fut Sg P2 => ap_ + "rirai" ;
Fut Sg P3 => ap_ + "rirà" ;
Fut Pl P1 => ap_ + "riremo" ;
Fut Pl P2 => ap_ + "rirete" ;
Fut Pl P3 => ap_ + "riranno" ;
Cong Pres Sg P1 => ap_ + "ra" ;
Cong Pres Sg P2 => ap_ + "ra" ;
Cong Pres Sg P3 => ap_ + "ra" ;
Cong Pres Pl P1 => ap_ + "riamo" ;
Cong Pres Pl P2 => ap_ + "riate" ;
Cong Pres Pl P3 => ap_ + "rano" ;
Cong Imperf Sg P1 => ap_ + "rissi" ;
Cong Imperf Sg P2 => ap_ + "rissi" ;
Cong Imperf Sg P3 => ap_ + "risse" ;
Cong Imperf Pl P1 => ap_ + "rissimo" ;
Cong Imperf Pl P2 => ap_ + "riste" ;
Cong Imperf Pl P3 => ap_ + "rissero" ;
Cond Sg P1 => ap_ + "rirei" ;
Cond Sg P2 => ap_ + "riresti" ;
Cond Sg P3 => ap_ + "rirebbe" ;
Cond Pl P1 => ap_ + "riremmo" ;
Cond Pl P2 => ap_ + "rireste" ;
Cond Pl P3 => ap_ + "rirebbero" ;
Imper SgP2 => ap_ + "ri" ;
Imper PlP1 => ap_ + "riamo" ;
Imper PlP2 => ap_ + "rite" ;
Ger => ap_ + "rendo" ;
Part PresP Masc Sg => ap_ + "rendo" ;
Part PresP Masc Pl => ap_ + "rendo" ;
Part PresP Fem Sg => ap_ + "rendo" ;
Part PresP Fem Pl => ap_ + "rendo" ;
Part PassP Masc Sg => ap_ + "erto" ;
Part PassP Masc Pl => ap_ + "erti" ;
Part PassP Fem Sg => ap_ + "erta" ;
Part PassP Fem Pl => ap_ + "erte"
}
} ;
oper fuggire_104 : Str -> Verbo = \fuggire ->
let fugg_ = Predef.tk 3 fuggire in
@@ -6212,7 +6274,72 @@ oper fuggire_104 : Str -> Verbo = \fuggire ->
}
} ;
oper morire_105 : Str -> Verbo = \morire ->
let mor_ = Predef.tk 3 morire ;
m_ = Predef.tk 5 morire
in
{s = table {
Inf => mor_ + "ire" ;
InfClit => mor_ + "ir" ;
Indi Pres Sg P1 => m_ + "uoio" ;
Indi Pres Sg P2 => m_ + "uori" ;
Indi Pres Sg P3 => m_ + "uore" ;
Indi Pres Pl P1 => mor_ + "iamo" ;
Indi Pres Pl P2 => mor_ + "ite" ;
Indi Pres Pl P3 => m_ + "uoiono" ;
Indi Imperf Sg P1 => mor_ + "ivo" ;
Indi Imperf Sg P2 => mor_ + "ivi" ;
Indi Imperf Sg P3 => mor_ + "iva" ;
Indi Imperf Pl P1 => mor_ + "ivamo" ;
Indi Imperf Pl P2 => mor_ + "ivate" ;
Indi Imperf Pl P3 => mor_ + "ivano" ;
Pass Sg P1 => mor_ + "ii" ;
Pass Sg P2 => mor_ + "isti" ;
Pass Sg P3 => mor_ + "ì" ;
Pass Pl P1 => mor_ + "immo" ;
Pass Pl P2 => mor_ + "iste" ;
Pass Pl P3 => mor_ + "irono" ;
Fut Sg P1 => mor_ + "irò" ; ---- also morrò etc
Fut Sg P2 => mor_ + "irai" ;
Fut Sg P3 => mor_ + "irà" ;
Fut Pl P1 => mor_ + "iremo" ;
Fut Pl P2 => mor_ + "irete" ;
Fut Pl P3 => mor_ + "iranno" ;
Cong Pres Sg P1 => m_ + "uoia" ;
Cong Pres Sg P2 => m_ + "uoia" ;
Cong Pres Sg P3 => m_ + "uoia" ;
Cong Pres Pl P1 => mor_ + "iamo" ;
Cong Pres Pl P2 => mor_ + "iate" ;
Cong Pres Pl P3 => m_ + "uoiano" ;
Cong Imperf Sg P1 => mor_ + "issi" ;
Cong Imperf Sg P2 => mor_ + "issi" ;
Cong Imperf Sg P3 => mor_ + "isse" ;
Cong Imperf Pl P1 => mor_ + "issimo" ;
Cong Imperf Pl P2 => mor_ + "iste" ;
Cong Imperf Pl P3 => mor_ + "issero" ;
Cond Sg P1 => mor_ + "irei" ;
Cond Sg P2 => mor_ + "iresti" ;
Cond Sg P3 => mor_ + "irebbe" ;
Cond Pl P1 => mor_ + "iremmo" ;
Cond Pl P2 => mor_ + "ireste" ;
Cond Pl P3 => mor_ + "irebbero" ;
Imper SgP2 => m_ + "uori" ;
Imper PlP1 => mor_ + "iamo" ;
Imper PlP2 => mor_ + "ite" ;
Ger => mor_ + "endo" ;
Part PresP Masc Sg => mor_ + "ente" ;
Part PresP Masc Pl => mor_ + "enti" ;
Part PresP Fem Sg => mor_ + "ente" ;
Part PresP Fem Pl => mor_ + "enti" ;
Part PassP Masc Sg => mor_ + "to" ;
Part PassP Masc Pl => mor_ + "ti" ;
Part PassP Fem Sg => mor_ + "ta" ;
Part PassP Fem Pl => mor_ + "te"
}
} ;
---- morire_105
---- salire_106
---- seguire_107
---- udire_108

View File

@@ -1,5 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete ClauseIta of Clause = CategoriesIta **
---- ClauseI with (Rules=RulesFre), (Verbphrase=VerbphraseFre) ;
ClauseRomance with (SyntaxRomance=SyntaxIta) ;

View File

@@ -322,7 +322,7 @@ oper
--2 Verbs
--
--3 The Bescherell conjugations.
--3 The Bescherelle conjugations.
--
-- The following conjugations tables were generated using FM software
-- from a Haskell source.

View File

@@ -194,10 +194,6 @@ oper
--2 Verbs
--
-- Irregular verbs are given in the module $VerbsFre$.
-- If a verb should be missing in that list, the module
-- $BeschFre$ gives all the patterns of the "Bescherelle" book.
--
-- Regular verbs are ones with the infinitive "er" or "ir", the
-- latter with plural present indicative forms as "finissons".
-- The regular verb function is the first conjugation recognizes
@@ -206,11 +202,17 @@ oper
regV : Str -> V ;
-- The module $BeschIta$ gives all the patterns of the "Bescherelle"
-- book. To use them in the category $V$, wrap them with the function
verboV : Verbo -> V ;
-- The function $regV$ gives all verbs the compound auxiliary "avoir".
-- To change it to "être", use the following function.
essereV : V -> V ;
--3 Two-place verbs
--
-- Two-place verbs need a preposition, except the special case with direct object.
@@ -329,6 +331,8 @@ oper
}
in verbPres verb AHabere ** {aux = AHabere ; lock_V = <>} ;
verboV ve = verbPres ve AHabere ** {lock_V = <>} ;
essereV v = {s = v.s ; aux = AEsse ; lock_V = <>} ;
mkV2 v p = {s = v.s ; aux = v.aux ; s2 = p.p2 ; c = p.p1 ; lock_V2 = <>} ;

View File

@@ -100,8 +100,8 @@ lin
--
SlashV2 = slashTransVerb ;
---- SlashVV2 = slashVerbVerb ;
---- SlashAdv = slashAdverb ;
SlashVV2 = slashVerbVerb ;
SlashAdv = slashAdverb ;
IdRP = identRelPron ;
FunRP = funRelPron ;
@@ -113,15 +113,19 @@ lin
--3 Questions and imperatives
--
---- IDetCN d n = detNounPhrase d n ;
IDetCN d n = let np = detNounPhrase d n in {
s = \\c => np.s ! case2pform c ;
g = pgen2gen np.g ;
n = np.n
};
FunIP = funIntPron ;
QuestCl = questClause ;
IntSlash = intSlash ;
QuestAdv = questAdverbial ;
---- PosImpVP = imperVerbPhrase True ;
---- NegImpVP = imperVerbPhrase False ;
PosImpVP = imperVerbPhrase True ;
NegImpVP = imperVerbPhrase False ;
IndicPhrase = indicUtt ;
QuestPhrase = interrogUtt ;
@@ -164,7 +168,7 @@ lin
PhrManyCN = useCommonNounPhrase plural ;
PhrIP ip = postfixSS "?" ip ;
PhrIAdv ia = postfixSS "?" ia ;
---- PhrVPI = verbUtterance ;
PhrVPI = verbUtterance ;
OnePhr p = p ;
ConsPhr = cc2 ;

View File

@@ -943,22 +943,24 @@ oper
ClauseSlashNounPhrase = Clause ** Complement ;
slashTransVerb : NounPhrase -> TransVerb -> ClauseSlashNounPhrase =
\jean,aimer -> variants {} ; ----
{- ----
predVerbGroupClause jean (predClauseGroup aimer (complVerb aimer)) **
complementOfTransVerb aimer ;
dummyNounPhrase : NounPhrase = mkNameNounPhrase [] Masc ;
slashTransVerb : NounPhrase -> TransVerb -> ClauseSlashNounPhrase = \np,v ->
sats2clause (mkSatsObject np v dummyNounPhrase) **
complementOfTransVerb v ;
slashVerbVerb : NounPhrase -> VerbVerb -> TransVerb -> ClauseSlashNounPhrase =
\jean,vouloir,aimer ->
predVerbGroupClause jean
(predClauseGroup aimer (complVerbVerb vouloir
(predVerbGroup True {s = [] ; a = Simul} (predClauseGroup aimer (complVerb aimer))))) **
complementOfTransVerb aimer ;
\subj, verb, tv ->
sats2clause (
insertExtrapos
(mkSats subj verb)
(\\_ => prepCase verb.c ++ tv.s ! VInfin)
) ** complementOfTransVerb tv ;
slashAdverb : Clause -> {s : Str ; c : CaseA} -> ClauseSlashNounPhrase =
\ilhabite,dans -> ilhabite ** {s2 = dans.s ; c = dans.c} ;
-}
--2 Relative pronouns and relative clauses
--
@@ -1165,11 +1167,10 @@ oper
Imperative = {s : Gender => Number => Str} ;
{- -----
imperVerbPhrase : VerbPhrase -> Imperative = \dormir ->
{s = \\g,n => dormir.s ! g ! VPF Simul (vImper n P2)
imperVerbPhrase : Bool -> VerbPhrase -> Imperative = \b,dormir ->
{s = \\g,n => dormir.s ! VIImperat b n ! g ! n ! P2
} ;
-}
imperUtterance : Number -> Imperative -> Utterance = \n,I ->
ss (I.s ! Masc ! n ++ "!") ;
@@ -1397,6 +1398,9 @@ oper
useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,mec ->
useNounPhrase (indefNounPhrase n mec) ;
verbUtterance : VerbPhrase -> Utterance = \vp ->
ss (vp.s ! VIInfinit ! Masc ! Sg ! P3) ;
-- one-form variants

View File

@@ -199,6 +199,12 @@ oper
regV : Str -> V ;
-- The module $BeschSpa$ gives all the patterns of the "Bescherelle"
-- book. To use them in the category $V$, wrap them with the function
verboV : Verbum -> V ;
--3 Two-place verbs
--
-- Two-place verbs need a preposition, except the special case with direct object.
@@ -318,6 +324,8 @@ oper
}
in verbPres verb AHabere ** {lock_V = <>} ;
verboV ve = verbPres ve AHabere ** {lock_V = <>} ;
mkV2 v p = {s = v.s ; aux = v.aux ; s2 = p.p2 ; c = p.p1 ; lock_V2 = <>} ;
dirV2 v = mkV2 v accusative ;
v2V v = v ** {lock_V = <>} ;

View File

@@ -312,5 +312,7 @@ oper
ouiPhr = ss ["Sí ."] ;
nonPhr = ss ["No ."] ;
negNe = "no" ; negPas = [] ;
}

View File

@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/02/18 19:21:16 $
-- > CVS $Author: peb $
-- > CVS $Revision: 1.6 $
-- > CVS $Date: 2005/03/31 15:47:43 $
-- > CVS $Author: aarne $
-- > CVS $Revision: 1.7 $
--
-- elementary text postprocessing. AR 21\/11\/2001.
--
@@ -22,6 +22,8 @@ module Text (untokWithXML,
formatAsTextLit,
formatAsCodeLit,
formatAsText,
formatAsHTML,
formatAsLatex,
formatAsCode,
performBinds,
unStringLit,
@@ -56,20 +58,26 @@ formatAsTextLit = formatAsText . unwords . map unStringLit . words
formatAsCodeLit :: String -> String
formatAsCodeLit = formatAsCode . unwords . map unStringLit . words
formatAsText :: String -> String
formatAsText = unwords . format . cap . words where
formatAsText,formatAsHTML,formatAsLatex :: String -> String
formatAsText = formatAsTextGen (=="&-") (=="&-")
formatAsHTML = formatAsTextGen ((=="<") . take 1) (const False)
formatAsLatex = formatAsTextGen ((=="\\") . take 1) (const False)
formatAsTextGen :: (String -> Bool) -> (String -> Bool) -> String -> String
formatAsTextGen tag para = unwords . format . cap . words where
format ws = case ws of
w : c : ww | major c -> (w ++ c) : format (cap ww)
w : c : ww | minor c -> (w ++ c) : format ww
w : c : ww | major c -> format $ (w ++ c) :(cap ww)
w : c : ww | minor c -> format $ (w ++ c) : ww
p : c : ww | openp p -> format $ (p ++ c) :ww
c : ww | para c -> "\n\n" : format ww
w : ww -> w : format ww
[] -> []
cap (p:(c:cs):ww) | para p = p : (toUpper c : cs) : ww
cap (p:ww) | tag p = p : cap ww
cap ((c:cs):ww) = (toUpper c : cs) : ww
cap [] = []
major = flip elem (map singleton ".!?")
minor = flip elem (map singleton ",:;")
para = (=="&-")
minor = flip elem (map singleton ",:;)")
openp = all (flip elem "(")
formatAsCode :: String -> String
formatAsCode = rend 0 . words where

View File

@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/03/29 13:26:37 $
-- > CVS $Date: 2005/03/31 15:47:43 $
-- > CVS $Author: aarne $
-- > CVS $Revision: 1.49 $
-- > CVS $Revision: 1.50 $
--
-- A database for customizable GF shell commands.
--
@@ -376,6 +376,8 @@ customUntokenizer =
[
(strCI "unwords", const $ id) -- DEFAULT
,(strCI "text", const $ formatAsText)
,(strCI "html", const $ formatAsHTML)
,(strCI "latex", const $ formatAsLatex)
,(strCI "code", const $ formatAsCode)
,(strCI "concat", const $ filter (not . isSpace))
,(strCI "textlit", const $ formatAsTextLit)