German phrasebook; ontology document; ignoring single lines in gfdoc

This commit is contained in:
aarne
2010-04-08 20:31:32 +00:00
parent 6aa9363b53
commit a459f0a449
16 changed files with 549 additions and 228 deletions

View File

@@ -36,7 +36,7 @@ isSpecific = flip elem specifics
replaceLang s1 s2 = repl where
repl s = case s of
c:cs -> case splitAt lgs s of
(pre,c:rest) | pre == s1 && elem c " ,:=(){}.-[]" -> s2 ++ [c] ++ repl rest
(pre,c:rest) | pre == s1 && elem c " \n\t,:=(){}.-[];" -> s2 ++ [c] ++ repl rest
_ -> c : repl cs
_ -> s
lgs = 3 -- length s1

View File

@@ -1,28 +1,28 @@
concrete GreetingsGer of Greetings = open Prelude in {
-- lincat
-- Greeting = SS ;
--
-- lin
-- GBye = ss "hej då" ;
-- GCheers = ss "skål" ;
-- GDamn = ss "fan" ;
-- GExcuse, GExcusePol = ss "ursäkta" ;
-- GGoodDay = ss "god dag" ;
-- GGoodEvening = ss "god afton" ;
-- GGoodMorning = ss "god morgon" ;
-- GGoodNight = ss "god natt" ;
-- GGoodbye = ss "hej då" ;
-- GHello = ss "hej" ;
-- GHelp = ss "hjälp" ;
-- GHowAreYou = ss "hur står det till" ;
-- GLookOut = ss "se upp" ;
-- GNiceToMeetYou = ss "trevligt att träffas" ;
-- GPleaseGive, GPleaseGivePol = ss "var så god" ;
-- GSeeYouSoon = ss "vi ses snart" ;
-- GSorry, GSorryPol = ss "förlåt" ;
-- GThanks = ss "tack" ;
-- GTheCheck = ss "notan" ;
--
-- }
lincat
Greeting = SS ;
lin
GBye = ss "tschüß" ;
GCheers = ss "zum Wohl" ;
GDamn = ss "Teufel" ;
GExcuse, GExcusePol = ss "Entschuldigung" ;
GGoodDay = ss "guten Tag" ;
GGoodEvening = ss "guten Abend" ;
GGoodMorning = ss "guten Morgen" ;
GGoodNight = ss "gute Nacht" ;
GGoodbye = ss "auf Wiedersehen" ;
GHello = ss "Hallo" ;
GHelp = ss "Hilfe" ;
GHowAreYou = ss "wie geht's" ;
GLookOut = ss "Achtung" ;
-- GNiceToMeetYou = ss "trevligt att träffas" ;
GPleaseGive, GPleaseGivePol = ss "bitte" ;
GSeeYouSoon = ss "bis bald" ;
GSorry, GSorryPol = ss "Entschuldigung" ;
GThanks = ss "Danke" ;
GTheCheck = ss "die Rechnung" ;
}

View File

@@ -1,7 +1,7 @@
all: demo missing
demo:
gf -make PhrasebookEng.gf PhrasebookFin.gf PhrasebookFre.gf PhrasebookIta.gf PhrasebookRon.gf PhrasebookSwe.gf DisambPhrasebookEng.gf
gf -make PhrasebookEng.gf PhrasebookFin.gf PhrasebookFre.gf PhrasebookGer.gf PhrasebookIta.gf PhrasebookRon.gf PhrasebookSwe.gf DisambPhrasebookEng.gf
#DisambPhrasebookRon.gf
pgf:
@@ -14,4 +14,8 @@ missing:
echo "pg -missing | wf -file=missing.txt" | gf Phrasebook???.gf
doc:
cat Sentences.gf Words.gf >Ontology.gf
gfdoc Ontology.gf
txt2tags -thtml phrasebook.txt
rm -f Ontology.gf

View File

@@ -0,0 +1,260 @@
<html>
<body>
<i> Produced by
gfdoc - a rudimentary GF document generator.
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
</i>
<p>
<h1> The Ontology of the Phrasebook</h1>
<h2> Syntactic Structures of the Phrasebook</h2>
This module contains phrases that can be defined by a functor over the
resource grammar API. The phrases that are likely to have different implementations
are in the module Words. But the distinction is not quite sharp; thus it may happen
that the functor instantiations make exceptions.
<pre>
abstract Sentences = Numeral ** {
</pre>
The ontology of the phrasebook is defined by the following types. The commented ones
are defined in other modules.
<pre>
cat
Phrase ; -- complete phrase, the unit of translation e.g. "Where are you?"
Sentence ; -- declarative sentence e.g. "I am in the bar"
Question ; -- question, either yes/no or wh e.g. "where are you"
-- Greeting ; -- idiomatic phrase, not inflected, e.g. "hello"
Proposition ; -- can be turned into sentence or question e.g. "this pizza is good"
Object ; -- the object of wanting, ordering, etc e.g. "three pizzas"
Item ; -- a single entity e.g. "this pizza"
Kind ; -- a type of an item e.g. "pizza"
Quality ; -- qualification of an item, can be complex e.g. "very good"
Property ; -- basic property of an item, one word e.g. "good"
Place ; -- location e.g. "the bar"
PlaceKind ; -- type of location e.g. "bar"
Currency ; -- currency unit e.g. "leu"
Price ; -- number of currency units e.g. "eleven leu"
Person ; -- agent wanting or doing something e.g. "you"
Action ; -- proposition about a Person e.g. "you are here"
Nationality ; -- complex of language, property, country e.g. "Swedish, Sweden"
Language ; -- language (can be without nationality) e.g. "Flemish"
Citizenship ; -- property (can be without language) e.g. "Belgian"
Country ; -- country (can be without language) e.g. "Belgium"
Day ; -- weekday type e.g. "Friday"
Date ; -- definite date e.g. "on Friday"
Name ; -- name of person e.g. "NN"
-- Numeral ; -- number expression 1 .. 999,999 e.g. "twenty"
</pre>
Many of the categories are accessible as Phrases, i.e. as translation units.
<pre>
fun
PSentence : Sentence -> Phrase ;
PQuestion : Question -> Phrase ;
PObject : Object -> Phrase ;
PKind : Kind -> Phrase ;
PQuality : Quality -> Phrase ;
PNumeral : Numeral -> Phrase ;
PPlace : Place -> Phrase ;
PPlaceKind : PlaceKind-> Phrase ;
PCurrency : Currency -> Phrase ;
PPrice : Price -> Phrase ;
PLanguage : Language -> Phrase ;
PCitizenship : Citizenship -> Phrase ;
PCountry : Country -> Phrase ;
PDay : Day -> Phrase ;
PYes, PNo : Phrase ;
</pre>
This is the way to build propositions about inanimate items.
<pre>
Is : Item -> Quality -> Proposition ; -- this pizza is good
</pre>
To use propositions on higher levels.
<pre>
SProp : Proposition -> Sentence ; -- this pizza is good
SPropNot : Proposition -> Sentence ; -- this pizza isn't good
QProp : Proposition -> Question ; -- is this pizza good
WherePlace : Place -> Question ; -- where is the bar
WherePerson : Person -> Question ; -- where are you
</pre>
This is the way to build propositions about persons.
<pre>
PropAction : Action -> Proposition ; -- (you (are|aren't) | are you) Swedish
</pre>
Here are some general syntactic constructions.
<pre>
ObjItem : Item -> Object ; -- this pizza
ObjNumber : Numeral -> Kind -> Object ; -- five pizzas
ObjIndef : Kind -> Object ; -- a pizza
SuchKind : Quality -> Kind -> Kind ; -- Italian pizza
Very : Property -> Quality ; -- very Italian
Too : Property -> Quality ; -- too Italian
PropQuality : Property -> Quality ; -- Italian
</pre>
Determiners.
<pre>
This, That, These, Those : Kind -> Item ; -- this pizza,...,those pizzas
The, Thes : Kind -> Item ; -- the pizza, the pizzas
AmountCurrency : Numeral -> Currency -> Price ; -- five euros
ThePlace : PlaceKind -> Place ; -- the bar
IMale, IFemale, -- I, said by man/woman (affects agreement)
YouFamMale, YouFamFemale, -- familiar you, said to man/woman (affects agreement)
YouPolMale, YouPolFemale : Person ; -- polite you, said to man/woman (affects agreement)
LangNat : Nationality -> Language ; -- Swedish
CitiNat : Nationality -> Citizenship ; -- Swedish
CountryNat : Nationality -> Country ; -- Sweden
PropCit : Citizenship -> Property ; -- Swedish
OnDay : Day -> Date ; -- on Friday
Today : Date ; -- today
PersonName : Name -> Person ; -- person referred by name
NameNN : Name ; -- the name "NN"
</pre>
Actions are typically language-dependent, not only lexically but also
structurally. However, these ones are mostly functorial.
<pre>
AHave : Person -> Kind -> Action ; -- you have a pizza
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
}
</pre>
<h2> Words and idiomatic phrases of the Phrasebook</h2>
<pre>
abstract Words = Sentences ** {
fun
</pre>
kinds of items (so far mostly food stuff)
<pre>
Apple : Kind ;
Beer : Kind ;
Bread : Kind ;
Cheese : Kind ;
Chicken : Kind ;
Coffee : Kind ;
Fish : Kind ;
Meat : Kind ;
Milk : Kind ;
Pizza : Kind ;
Salt : Kind ;
Tea : Kind ;
Water : Kind ;
Wine : Kind ;
</pre>
properties of kinds (so far mostly of food)
<pre>
Bad : Property ;
Boring : Property ;
Cheap : Property ;
Cold : Property ;
Delicious : Property ;
Expensive : Property ;
Fresh : Property ;
Good : Property ;
Suspect : Property ;
Warm : Property ;
</pre>
kinds of places
<pre>
Airport : PlaceKind ;
Bar : PlaceKind ;
Cinema : PlaceKind ;
Church : PlaceKind ;
Hospital : PlaceKind ;
Hotel : PlaceKind ;
Museum : PlaceKind ;
Park : PlaceKind ;
Restaurant : PlaceKind ;
School : PlaceKind ;
Shop : PlaceKind ;
Station : PlaceKind ;
Theatre : PlaceKind ;
Toilet : PlaceKind ;
University : PlaceKind ;
</pre>
currency units
<pre>
DanishCrown : Currency ;
Dollar : Currency ;
Euro : Currency ;
Lei : Currency ;
SwedishCrown : Currency ;
</pre>
nationalities, countries, languages, citizenships
<pre>
Belgian : Citizenship ;
Belgium : Country ;
English : Nationality ;
Finnish : Nationality ;
Flemish : Language ;
French : Nationality ;
Italian : Nationality ;
Romanian : Nationality ;
Swedish : Nationality ;
</pre>
Actions (which can be expressed by different structures in different languages).
Notice that also negations and questions can be formed from these.
<pre>
AHasName : Person -> Name -> Action ; -- my name is Bond
AHungry : Person -> Action ; -- I am hungry
AIll : Person -> Action ; -- I am ill
AKnow : Person -> Action ; -- I (don't) know
ALike : Person -> Item -> Action ; -- I like this pizza
ALive : Person -> Country -> Action ; -- I live in Sweden
ALove : Person -> Person -> Action ; -- I love you
AScared : Person -> Action ; -- I am scared
ASpeak : Person -> Language -> Action ; -- I speak Finnish
AThirsty : Person -> Action ; -- I am thirsty
ATired : Person -> Action ; -- I am tired
AUnderstand : Person -> Action ; -- I (don't) understand
AWant : Person -> Object -> Action ; -- I want two beers
AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
</pre>
miscellaneous phrases
<pre>
QWhatName : Person -> Question ; -- what is your name
PropOpen : Place -> Proposition ; -- the museum is open
PropClosed : Place -> Proposition ; -- the museum is closed
PropOpenDate : Place -> Date -> Proposition ; -- the museum is open today
PropClosedDate : Place -> Date -> Proposition ; -- the museum is closed today
PropOpenDay : Place -> Day -> Proposition ; -- the museum is open on Mondays
PropClosedDay : Place -> Day -> Proposition ; -- the museum is closed on Mondays
HowMuchCost : Item -> Question ; -- how much does the pizza cost
ItCost : Item -> Price -> Proposition ; -- the pizza costs five euros
</pre>
week days
<pre>
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday : Day ;
}
</pre>
</body>
</html>

View File

@@ -1,3 +1,6 @@
--1 The Ontology of the Phrasebook
--2 Syntactic Structures of the Phrasebook
-- This module contains phrases that can be defined by a functor over the
-- resource grammar API. The phrases that are likely to have different implementations
@@ -6,7 +9,8 @@
abstract Sentences = Numeral ** {
-- The ontology of the phrasebook is defined by the following types.
-- The ontology of the phrasebook is defined by the following types. The commented ones
-- are defined in other modules.
cat
Phrase ; -- complete phrase, the unit of translation e.g. "Where are you?"
@@ -37,21 +41,21 @@ abstract Sentences = Numeral ** {
-- Many of the categories are accessible as Phrases, i.e. as translation units.
fun
PSentence : Sentence -> Phrase ;
PQuestion : Question -> Phrase ;
PSentence : Sentence -> Phrase ;
PQuestion : Question -> Phrase ;
PObject : Object -> Phrase ;
PKind : Kind -> Phrase ;
PQuality : Quality -> Phrase ;
PNumeral : Numeral -> Phrase ;
PPlace : Place -> Phrase ;
PPlaceKind: PlaceKind-> Phrase ;
PCurrency : Currency -> Phrase ;
PPrice : Price -> Phrase ;
PLanguage : Language -> Phrase ;
PObject : Object -> Phrase ;
PKind : Kind -> Phrase ;
PQuality : Quality -> Phrase ;
PNumeral : Numeral -> Phrase ;
PPlace : Place -> Phrase ;
PPlaceKind : PlaceKind-> Phrase ;
PCurrency : Currency -> Phrase ;
PPrice : Price -> Phrase ;
PLanguage : Language -> Phrase ;
PCitizenship : Citizenship -> Phrase ;
PCountry : Country -> Phrase ;
PDay : Day -> Phrase ;
PCountry : Country -> Phrase ;
PDay : Day -> Phrase ;
PYes, PNo : Phrase ;
@@ -59,11 +63,13 @@ abstract Sentences = Numeral ** {
Is : Item -> Quality -> Proposition ; -- this pizza is good
-- To use propositions on higher levels.
SProp : Proposition -> Sentence ; -- this pizza is good
SPropNot : Proposition -> Sentence ; -- this pizza isn't good
QProp : Proposition -> Question ; -- is this pizza good
WherePlace : Place -> Question ; -- where is the bar
WherePlace : Place -> Question ; -- where is the bar
WherePerson : Person -> Question ; -- where are you
-- This is the way to build propositions about persons.
@@ -99,13 +105,13 @@ abstract Sentences = Numeral ** {
CountryNat : Nationality -> Country ; -- Sweden
PropCit : Citizenship -> Property ; -- Swedish
OnDay : Day -> Date ; -- on Friday
Today : Date ; -- today
OnDay : Day -> Date ; -- on Friday
Today : Date ; -- today
PersonName : Name -> Person ; -- person referred by name
NameNN : Name ; -- the name "NN"
---- NameString : String -> Name ; ---- creates ambiguities with all words
---- NameString : String -> Name ; ---- creates ambiguities with all words --%
-- Actions are typically language-dependent, not only lexically but also
-- structurally. However, these ones are mostly functorial.
@@ -114,6 +120,5 @@ abstract Sentences = Numeral ** {
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
}

View File

@@ -5,5 +5,5 @@ concrete SentencesFin of Sentences = NumeralFin ** SentencesI - [Is,NameNN] with
lin
Is item prop = mkCl item (V.UseComp (CompPartAP prop)) ; -- pizza on herkullista
NameNN = mkNP (P.mkPN "NN") ;
NameNN = mkNP (P.mkPN (P.mkN "NN" "NN:iä")) ;
} ;

View File

@@ -20,4 +20,8 @@ doUpdate src (target,ls) = do
appendFile tmp $ unlines [(line ++ "-- UPDATE FROM " ++ src) | line <- ls]
appendFile tmp "\n}\n"
dropLastBracket s = s
tmpFile file = "tmp-update/"++ file
---- quick and dirty
dropLastBracket = reverse . init . dropWhile (/='}') . reverse

View File

@@ -1,4 +1,7 @@
-- (c) 2009 Aarne Ranta under LGPL
--2 Words and idiomatic phrases of the Phrasebook
-- (c) 2009 Aarne Ranta under LGPL --%
abstract Words = Sentences ** {
@@ -72,33 +75,34 @@ abstract Words = Sentences ** {
Romanian : Nationality ;
Swedish : Nationality ;
-- actions (which can be expressed by different structures in different languages)
-- Actions (which can be expressed by different structures in different languages).
-- Notice that also negations and questions can be formed from these.
AHasName : Person -> Name -> Action ;
AHungry : Person -> Action ;
AIll : Person -> Action ;
AKnow : Person -> Action ;
ALike : Person -> Item -> Action ;
ALive : Person -> Country -> Action ;
ALove : Person -> Person -> Action ;
AScared : Person -> Action ;
ASpeak : Person -> Language -> Action ;
AThirsty : Person -> Action ;
ATired : Person -> Action ;
AUnderstand : Person -> Action ;
AWant : Person -> Object -> Action ;
AWantGo : Person -> Place -> Action ;
AHasName : Person -> Name -> Action ; -- my name is Bond
AHungry : Person -> Action ; -- I am hungry
AIll : Person -> Action ; -- I am ill
AKnow : Person -> Action ; -- I (don't) know
ALike : Person -> Item -> Action ; -- I like this pizza
ALive : Person -> Country -> Action ; -- I live in Sweden
ALove : Person -> Person -> Action ; -- I love you
AScared : Person -> Action ; -- I am scared
ASpeak : Person -> Language -> Action ; -- I speak Finnish
AThirsty : Person -> Action ; -- I am thirsty
ATired : Person -> Action ; -- I am tired
AUnderstand : Person -> Action ; -- I (don't) understand
AWant : Person -> Object -> Action ; -- I want two beers
AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
-- miscellaneous phrases
QWhatName : Person -> Question ;
QWhatName : Person -> Question ; -- what is your name
PropOpen : Place -> Proposition ;
PropClosed : Place -> Proposition ;
PropOpenDate : Place -> Date -> Proposition ;
PropClosedDate : Place -> Date -> Proposition ;
PropOpenDay : Place -> Day -> Proposition ;
PropClosedDay : Place -> Day -> Proposition ;
PropOpen : Place -> Proposition ; -- the museum is open
PropClosed : Place -> Proposition ; -- the museum is closed
PropOpenDate : Place -> Date -> Proposition ; -- the museum is open today
PropClosedDate : Place -> Date -> Proposition ; -- the museum is closed today
PropOpenDay : Place -> Day -> Proposition ; -- the museum is open on Mondays
PropClosedDay : Place -> Day -> Proposition ; -- the museum is closed on Mondays
HowMuchCost : Item -> Question ; -- how much does the pizza cost
ItCost : Item -> Price -> Proposition ; -- the pizza costs five euros

View File

@@ -144,6 +144,10 @@ concrete WordsFin of Words = SentencesFin **
closed_Adv = ParadigmsFin.mkAdv "kiinni" ;
nameOf : {name : NP ; isPron : Bool ; poss : Det} -> NP = \p ->
mkNP (E.GenNP p.name) (mkN "nimi" "nimiä") ;
let nimi = L.name_N in
case p.isPron of {
True => mkNP p.poss nimi ;
_ => mkNP (E.GenNP p.name) nimi
} ;
}

View File

@@ -10,125 +10,120 @@ concrete WordsGer of Words = SentencesGer **
Apple = mkCN L.apple_N ;
Beer = mkCN L.beer_N ;
Bread = mkCN L.bread_N ;
-- Cheese = mkCN (mkN "ost") ;
-- Coffee = mkCN (mkN "kaffe" neutrum) ;
Cheese = mkCN (mkN "Käse" "Käse" masculine) ;
-- Coffee = mkCN (mkN "Kaffee" "Kaffee" masculine) ;
Fish = mkCN L.fish_N ;
Milk = mkCN L.milk_N ;
-- Pizza = mkCN (mkN "pizza") ;
Pizza = mkCN (mkN "pizza" "pizzen" feminine) ;
Salt = mkCN L.salt_N ;
-- Tea = mkCN (mkN "te" neutrum) ;
-- Tea = mkCN (mkN "Tee" neutrum) ;
Water = mkCN L.water_N ;
Wine = mkCN L.wine_N ;
-- properties
Bad = L.bad_A ;
-- Boring = mkA "tråkig" ;
Boring = mkA "langweilig" ;
Cold = L.cold_A ;
-- Delicious = mkA "läcker" ;
-- Expensive = mkA "dyr" ;
-- Fresh = mkA "färsk" ;
Delicious = mkA "lecker" ;
Expensive = mkA "teuer" ;
Fresh = mkA "frisch" ;
Good = L.good_A ;
Warm = L.warm_A ;
--
-- -- places
--
-- Airport = mkPlace (mkN "flygplats" "flygplatser") "på" ;
-- places
Airport = mkPlace (mkN "Flughafen" "Flughäfen" masculine) on_Prep to_Prep ;
-- Bar = mkPlace (mkN "bar" "barer") "i" ;
-- Church = mkPlace (mkN "kyrka") "i" ;
-- Hospital = mkPlace (mkN "sjukhus" "sjukhus") "på" ;
Church = mkPlace (mkN "Kirche") in_Prep to_Prep ;
Hospital = mkPlace (mkN "Krankenhaus" "Krankenhäuser" neuter) in_Prep to_Prep ;
-- Museum = mkPlace (mkN "museum" "museet" "museer" "museerna") "på" ;
-- Restaurant = mkPlace (mkN "restaurang" "restauranger") "på" ;
-- Station = mkPlace (mkN "station" "stationer") "på" ;
Restaurant = mkPlace (mkN "Restaurant" "Restaurants" neuter) in_Prep to_Prep ;
Station = mkPlace (mkN "Bahnhofen" "Bahnhöfen" masculine) on_Prep to_Prep ;
-- Toilet = mkPlace (mkN "toalett" "toaletter") "på" ;
--
-- -- currencies
--
-- DanishCrown = mkCN (mkA "dansk") (mkN "krona") ;
University = mkPlace (mkN "Universität" "Universitäten" feminine)
(mkPrep "an" dative) (mkPrep "an" accusative) ;
-- currencies
DanishCrown = mkCN (mkA "Dänisch") (mkN "Krone") ;
-- Dollar = mkCN (mkN "dollar" "dollar") ;
-- Euro = mkCN (mkN "euro" "euro") ;
Euro = mkCN (mkN "Euro" "Euro" neuter) ;
-- Lei = mkCN (mkN "lei" "lei") ;
-- SwedishCrown = mkCN (mkA "svensk") (mkN "krona") ;
--
-- -- nationalities
--
-- Belgian = mkA "belgisk" ;
-- Belgium = mkNP (mkPN "Belgien") ;
-- English = mkNat "engelsk" "England" ;
-- Finnish = mkNat "finsk" "Finland" ;
-- nationalities
Belgian = mkA "Belgisch" ;
Belgium = mkNP (mkPN "Belgien") ;
English = mkNat "Englisch" "England" ;
Finnish = mkNat "Finnisch" "Finnland" ;
-- Flemish = mkNP (mkPN "flamländska") ;
-- French = mkNat "fransk" "Frankrike" ;
-- Italian = mkNat "italiensk" "Italien" ;
French = mkNat "Französisch" "Frankreich" ;
Italian = mkNat "Italienisch" "Italien" ;
-- Romanian = mkNat "rumänsk" "Rumänien" ;
-- Swedish = mkNat "svensk" "Sverige" ;
--
-- -- actions
--
-- AHasName p name = mkCl (nameOf p) name ;
-- AHungry p = mkCl p.name (mkA "hungrig") ;
-- AIll p = mkCl p.name (mkA "sjuk") ;
-- AKnow p = mkCl p.name (mkV "veta" "vet" "vet" "visste" "vetat" "visst") ;
-- ALike p item = mkCl p.name (mkV2 (mkV "tycker") (mkPrep "om")) item ;
-- ALive p co = mkCl p.name (mkVP (mkVP (mkV "bo")) (SyntaxGer.mkAdv in_Prep co)) ;
-- ALove p q = mkCl p.name (mkV2 (mkV "älska")) q.name ;
-- AScared p = mkCl p.name (mkA "rädd") ;
-- ASpeak p lang = mkCl p.name (mkV2 (mkV "tala")) lang ;
-- AThirsty p = mkCl p.name (mkA "rstig") ;
-- ATired p = mkCl p.name (mkA "trött") ;
-- AUnderstand p = mkCl p.name (mkV "förstå" "förstod" "förstått") ;
AHasName p name = mkCl p.name (mkV2 heißen_V) name ;
AHungry p = mkCl p.name (mkA "hungrig") ;
AIll p = mkCl p.name (mkA "Krank") ;
AKnow p = mkCl p.name wissen_V ;
ALike p item = mkCl item (mkV2 (fixprefixV "ge" (fallen_V)) dative) p.name ;
ALive p co = mkCl p.name (mkVP (mkVP (mkV "wohnen")) (SyntaxGer.mkAdv in_Prep co)) ;
ALove p q = mkCl p.name (mkV2 (mkV "lieben")) q.name ;
AScared p = mkCl p.name have_V2 (mkNP (mkN "Angst" "Angsten" feminine)) ;
ASpeak p lang = mkCl p.name (mkV2 sprechen_V) lang ;
AThirsty p = mkCl p.name (mkA "rstig") ;
ATired p = mkCl p.name (mkA "müde") ;
AUnderstand p = mkCl p.name (fixprefixV "ver" stehen_V) ;
AWant p obj = mkCl p.name want_VV (mkVP have_V2 obj) ;
AWantGo p place = mkCl p.name want_VV (mkVP (mkVP L.go_V) place.to) ;
--
-- -- miscellaneous
--
-- QWhatName p = mkQS (mkQCl whatSg_IP (mkVP (nameOf p))) ;
--
-- PropOpen p = mkCl p.name open_A ;
-- PropClosed p = mkCl p.name closed_A ;
-- PropOpenDate p d = mkCl p.name (mkVP (mkVP open_A) d) ;
-- PropClosedDate p d = mkCl p.name (mkVP (mkVP closed_A) d) ;
-- PropOpenDay p d = mkCl p.name (mkVP (mkVP open_A) d.habitual) ;
-- PropClosedDay p d = mkCl p.name (mkVP (mkVP closed_A) d.habitual) ;
--
-- HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item (mkV "kosta"))) ;
-- ItCost item price = mkCl item (mkV2 (mkV "kosta")) price ;
--
-- -- week days
--
-- Monday = mkDay "måndag" ;
-- Tuesday = mkDay "tisdag" ;
-- Wednesday = mkDay "onsdag" ;
-- Thursday = mkDay "torsdag" ;
-- Friday = mkDay "fredag" ;
-- Saturday = mkDay "lördag" ;
-- Sunday = mkDay "söndag" ;
--
-- oper
-- mkNat : Str -> Str -> {lang : NP ; prop : A ; country : NP} = \nat,co ->
-- {lang = mkNP (mkPN (nat + "a")) ;
-- prop = mkA nat ; country = mkNP (mkPN co)} ;
--
-- mkDay : Str -> {name : NP ; point : Adv ; habitual : Adv} = \d ->
-- let day = mkNP (mkPN d) in
-- {name = day ;
-- point = SyntaxGer.mkAdv on_Prep day ;
-- habitual = SyntaxGer.mkAdv on_Prep (mkNP a_Quant plNum (mkCN (mkN d)))
-- } ;
--
-- mkPlace : N -> Str -> {name : CN ; at : Prep ; to : Prep} = \p,i -> {
-- name = mkCN p ;
-- at = mkPrep i ;
-- to = to_Prep
-- } ;
--
-- open_A = mkA "öppen" "öppet" ;
-- closed_A = mkA "stängd" "stängt" ;
--
-- nameOf : {name : NP ; isPron : Bool ; poss : Det} -> NP = \p ->
-- case p.isPron of {
-- True => mkNP p.poss (mkN "namn" "namn") ;
-- _ => mkNP (mkNP the_Det (mkN "namn" "namn"))
-- (SyntaxGer.mkAdv possess_Prep p.name)
-- } ;
-- }
-- miscellaneous
QWhatName p = mkQS (mkQCl how_IAdv (mkCl p.name heißen_V)) ;
PropOpen p = mkCl p.name open_Adv ;
PropClosed p = mkCl p.name closed_Adv ;
PropOpenDate p d = mkCl p.name (mkVP (mkVP d) open_Adv) ;
PropClosedDate p d = mkCl p.name (mkVP (mkVP d) closed_Adv) ;
PropOpenDay p d = mkCl p.name (mkVP (mkVP d.habitual) open_Adv) ;
PropClosedDay p d = mkCl p.name (mkVP (mkVP d.habitual) closed_Adv) ;
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item (mkV "kosten"))) ;
ItCost item price = mkCl item (mkV2 (mkV "kosten")) price ;
-- week days
Monday = mkDay "Montag" ;
Tuesday = mkDay "Dienstag" ;
Wednesday = mkDay "Mittwoch" ;
Thursday = mkDay "Donnerstag" ;
Friday = mkDay "Freitag" ;
Saturday = mkDay "Samstag" ;
Sunday = mkDay "Sonntag" ;
oper
mkNat : Str -> Str -> {lang : NP ; prop : A ; country : NP} = \nat,co ->
{lang = mkNP (mkPN nat) ;
prop = mkA nat ; country = mkNP (mkPN co)} ;
mkDay : Str -> {name : NP ; point : Adv ; habitual : Adv} = \d ->
let day = mkNP (mkPN d) in
{name = day ;
point = SyntaxGer.mkAdv (mkPrep "am" dative) day ; ---- am
habitual = ParadigmsGer.mkAdv (d + "s") ----
} ;
mkPlace : N -> Prep -> Prep -> {name : CN ; at : Prep ; to : Prep} = \p,at,to -> {
name = mkCN p ;
at = at ;
to = to
} ;
open_Adv = mkAdv "geöffnet" ; ---- Adv to get right word order easily
closed_Adv = mkAdv "geschlossen" ;
}

View File

@@ -64,7 +64,7 @@ concrete WordsSwe of Words = SentencesSwe **
-- actions
AHasName p name = mkCl (nameOf p) name ;
AHasName p name = mkCl p.name (mkV2 (mkV "heter")) name ;
AHungry p = mkCl p.name (mkA "hungrig") ;
AIll p = mkCl p.name (mkA "sjuk") ;
AKnow p = mkCl p.name (mkV "veta" "vet" "vet" "visste" "vetat" "visst") ;
@@ -81,7 +81,7 @@ concrete WordsSwe of Words = SentencesSwe **
-- miscellaneous
QWhatName p = mkQS (mkQCl whatSg_IP (mkVP (nameOf p))) ;
QWhatName p = mkQS (mkQCl whatSg_IP p.name (mkV2 (mkV "heter"))) ;
PropOpen p = mkCl p.name open_A ;
PropClosed p = mkCl p.name closed_A ;

View File

@@ -1,12 +1,35 @@
abstract Greetings
+ Greetings
fun GCongratulations : Greeting ;
fun GLeaveMeAlone : Greeting ;
+ GreetingsEng
lin GCongratulations = ss "congratulations" ;
+ GreetingsFin
lin GCongratulations = ss "onneksi olkoon" ;
lin GLeaveMeAlone = ss "jätä minut rauhaan" ;
lin
Eng = ss "congratulations" ;
Fin = ss "onneksi olkoon" ;
Fre = ss "félicitations" ;
Ita = ss "auguri" ;
Swe = ss "grattis" ;
lin
Eng = ss "leave me alone" ;
Swe = ss "låt mig vara i fred" ;
abstract Words
fun Library : PlaceKind ;
lin
Eng = mkPlace "library" "in" ;
Fin = mkPlace (mkN "kirjasto") ssa ;
Fre = mkPlace (mkN "bibliothèque") dative ;
Swe = mkPlace (mkN "bibliotek" "bibliotek") "på" ;
concrete WordsGer
lin Delicious = mkA "köstlich" ;
lin Expensive = mkA "teuer" ;

View File

@@ -5,7 +5,7 @@ PhrasebookDut : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak ATh
PhrasebookEng :
PhrasebookFin : Cinema DanishCrown SwedishCrown Theatre
PhrasebookFre : Cheap Cinema Hotel Park School Shop Suspect Theatre University
PhrasebookGer : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday
PhrasebookGer : Bar Cheap Chicken Cinema Coffee Dollar Flemish GNiceToMeetYou Hotel Lei Meat Museum Park Romanian School Shop Suspect Swedish SwedishCrown Tea Theatre Toilet
PhrasebookIta : Cheap Chicken Cinema GNiceToMeetYou Hotel Meat Park School Shop Suspect SwedishCrown Theatre University
PhrasebookNor : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand AWant AWantGo Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday
PhrasebookPol : AHasName AHungry AIll AKnow ALike ALive ALove AScared ASpeak AThirsty ATired AUnderstand AWant AWantGo Airport Bar Belgian Belgium Boring Cheap Cheese Chicken Church Cinema Coffee DanishCrown Delicious Dollar English Euro Expensive Finnish Flemish French Fresh Friday GBye GCheers GDamn GExcuse GExcusePol GGoodDay GGoodEvening GGoodMorning GGoodNight GGoodbye GHello GHelp GHowAreYou GLookOut GNiceToMeetYou GPleaseGive GPleaseGivePol GSeeYouSoon GSorry GSorryPol GThanks GTheCheck Hospital Hotel HowMuchCost ItCost Italian Lei Meat Monday Museum Park Pizza PropClosed PropClosedDate PropClosedDay PropOpen PropOpenDate PropOpenDay QWhatName Restaurant Romanian Saturday School Shop Station Sunday Suspect Swedish SwedishCrown Tea Theatre Thursday Toilet Tuesday University Wednesday

View File

@@ -17,6 +17,7 @@
History
</P>
<UL>
<LI>8 April. Added German.
<LI>7 April. Added the Clone script, applied to initiate the rest of MOLTO languages.
<LI>6 April. Version 0.4: weekdays, nationalities
<LI>30 March. Version 0.3: disambiguation grammar for English
@@ -50,15 +51,15 @@ between the 15 European languages included in the
<P>
It is implemented by using the GF programming language
(<A HREF="http://grammaticalframework.org">Grammatical Framework</A>).
It is the first demo for the MOLTO project, released in the third month but to be
updated in the course of the project.
It is the first demo for the MOLTO project, released in the third month (by June 2010)
but to be updated in the course of the project.
</P>
<P>
The phrasebook has the following requirements:
</P>
<UL>
<LI>high quality: reliable translations
<LI>translation from any language to any other ones
<LI>high quality: reliable translations to express yourself in any language
<LI>translation between all pairs of languages
<LI>runnable in web browsers
<LI>runnable on mobile phones (also off-line: forthcoming for Android phones)
<LI>easily extensible by new words (forthcoming: semi-automatic extensions by users)
@@ -70,12 +71,13 @@ The source code resides in
<A HREF="http://code.haskell.org/gf/examples/phrasebook/"><CODE>code.haskell.org/gf/examples/phrasebook/</CODE></A>
</P>
<P>
Current status (7 April 2010):
Current status (8 April 2010):
</P>
<UL>
<LI>small coverage in abstract syntax
<LI>reasonable implementations for English, Finnish, French, Italian, Romanian, Swedish
<LI>reasonable implementations for English, Finnish, French, German, Italian, Romanian, Swedish
<LI>almost just cloned for the rest of MOLTO languages
<LI>temporary user interdace
<LI>works on web browsers calling a server
<LI>web service not yet released, but preliminarily available in
<A HREF="http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html"><CODE>http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html</CODE></A>
@@ -83,6 +85,12 @@ Current status (7 April 2010):
<H1>Points illustrated</H1>
<P>
Interlingua-based translation.
</P>
<P>
Incremental parsing.
</P>
<P>
The use of resource grammars and functors.
</P>
<P>
@@ -97,10 +105,13 @@ Disambiguation, esp. of politeness distinctions.
<H1>Ontology</H1>
<P>
The abstract syntax defines the <B>ontology</B> behind the phrasebook.
Some explanations can be found in the abstract syntax files
Some explanations can be found in the
<A HREF="Ontology.html">ontology document</A>, which is produced from the
abstract syntax files
<A HREF="http://code.haskell.org/gf/examples/phrasebook/Sentences.gf"><CODE>Sentences.gf</CODE></A>
and
<A HREF="http://code.haskell.org/gf/examples/phrasebook/Words.gf"><CODE>Words.gf</CODE></A>.
<A HREF="http://code.haskell.org/gf/examples/phrasebook/Words.gf"><CODE>Words.gf</CODE></A>
by <CODE>make doc</CODE>.
</P>
<H1>Files</H1>
<P>
@@ -124,7 +135,7 @@ Separate concrete syntaxes.
the input language is ambiguous.
</P>
<P>
Here is the module structure as produced by
Here is the module structure as produced in GF by
</P>
<PRE>
&gt; i -retain DisambPhrasebookEng.gf
@@ -142,7 +153,7 @@ Improved translation interface
<UL>
<LI>a <I>to</I> list of languages: either <I>all</I>, or just one
<LI>combined text field/fridge magnet input; filter magnets by started word prefix
<LI>a nicer way to show disambiguation (smaller font, maybe hidden by default)
<LI>a nicer way to show disambiguation (maybe hidden by default)
</UL>
<P>
@@ -166,6 +177,10 @@ Link to Google translate, for fall-back and for comparison
<P>
Feedback facility in the UI
</P>
<P>
Customizable distribution: make your own selection of the 2^15 language subsets
when downloading the phrasebook to a phone
</P>
<H1>How to contribute</H1>
<P>
The basic things "everyone" can do is
@@ -188,12 +203,15 @@ Here are the steps to follow for contributors:
</P>
<OL>
<LI>Make sure you have the latest sources
from <A HREF="http://www.grammaticalframework.org/doc/gf-developers.html">GF Darcs</A>, using <CODE>darcs pull</CODE>.
from <A HREF="http://www.grammaticalframework.org/doc/gf-developers.html">GF Darcs</A>,
using <CODE>darcs pull</CODE>.
<LI>Also make sure that you have compiled the library by <CODE>make present</CODE> in <CODE>gf/lib/src/</CODE>.
<LI>Work in the directory <A HREF="http://code.haskell.org/gf/examples/phrasebook/"><CODE>gf/examples/phrasebook/</CODE></A>.
<LI>After you've finished your contribution, recompile the phrasebook by <CODE>make</CODE>.
<LI>Work in the directory
<A HREF="http://code.haskell.org/gf/examples/phrasebook/"><CODE>gf/examples/phrasebook/</CODE></A>.
<LI>After you've finished your contribution, recompile the phrasebook by <CODE>make pgf</CODE>.
<LI>Save your changes in <CODE>darcs record .</CODE> (in the <CODE>phrasebook</CODE> subdirectory).
<LI>Make a patch file with <CODE>darcs send -o my_phrasebook_patch</CODE>, which you can send to GF maintainers.
<LI>Make a patch file with <CODE>darcs send -o my_phrasebook_patch</CODE>, which you can
send to GF maintainers.
<LI>(Recommended:) Test the phrasebook on your local server:
<OL>
<LI>Go to <CODE>gf/src/server/</CODE> and follow the instructions in the
@@ -206,8 +224,9 @@ Here are the steps to follow for contributors:
<UL>
<LI>Don't delete anything! But you are free to correct incorrect forms.
<LI>Don't change the module structure! But you are free to add a new language.
<LI>Don't change the module structure!
<LI>Don't compromise quality to gain coverage: <I>non multa sed multum!</I>
<P></P>
</UL>

View File

@@ -13,6 +13,7 @@ Aarne Ranta
#BSMALL
History
- 8 April. Added German.
- 7 April. Added the Clone script, applied to initiate the rest of MOLTO languages.
- 6 April. Version 0.4: weekdays, nationalities
- 30 March. Version 0.3: disambiguation grammar for English
@@ -41,12 +42,12 @@ between the 15 European languages included in the
It is implemented by using the GF programming language
([Grammatical Framework http://grammaticalframework.org]).
It is the first demo for the MOLTO project, released in the third month but to be
updated in the course of the project.
It is the first demo for the MOLTO project, released in the third month (by June 2010)
but to be updated in the course of the project.
The phrasebook has the following requirements:
- high quality: reliable translations
- translation from any language to any other ones
- high quality: reliable translations to express yourself in any language
- translation between all pairs of languages
- runnable in web browsers
- runnable on mobile phones (also off-line: forthcoming for Android phones)
- easily extensible by new words (forthcoming: semi-automatic extensions by users)
@@ -57,10 +58,11 @@ The source code resides in
[``code.haskell.org/gf/examples/phrasebook/`` http://code.haskell.org/gf/examples/phrasebook/]
Current status (7 April 2010):
Current status (8 April 2010):
- small coverage in abstract syntax
- reasonable implementations for English, Finnish, French, Italian, Romanian, Swedish
- reasonable implementations for English, Finnish, French, German, Italian, Romanian, Swedish
- almost just cloned for the rest of MOLTO languages
- temporary user interdace
- works on web browsers calling a server
- web service not yet released, but preliminarily available in
[``http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html`` http://tournesol.cs.chalmers.se/~aarne/phrasebook/phrasebook.html]
@@ -69,6 +71,10 @@ Current status (7 April 2010):
=Points illustrated=
Interlingua-based translation.
Incremental parsing.
The use of resource grammars and functors.
Compile-time transfer: especially, in Action in Words.
@@ -78,13 +84,19 @@ Quasi-incremental translation: many basic types are also used as phrases.
Disambiguation, esp. of politeness distinctions.
=Ontology=
The abstract syntax defines the **ontology** behind the phrasebook.
Some explanations can be found in the abstract syntax files
Some explanations can be found in the
[ontology document Ontology.html], which is produced from the
abstract syntax files
[``Sentences.gf`` http://code.haskell.org/gf/examples/phrasebook/Sentences.gf]
and
[``Words.gf`` http://code.haskell.org/gf/examples/phrasebook/Words.gf].
[``Words.gf`` http://code.haskell.org/gf/examples/phrasebook/Words.gf]
by ``make doc``.
@@ -105,7 +117,7 @@ Separate concrete syntaxes.
``DisambPhrasebook``: disambiguation grammars generating feedback phrases if
the input language is ambiguous.
Here is the module structure as produced by
Here is the module structure as produced in GF by
```
> i -retain DisambPhrasebookEng.gf
> dg -only=Phrasebook*,Sentences*,Words*,Greetings*,DisambPhrasebookEng
@@ -121,7 +133,7 @@ Here is the module structure as produced by
Improved translation interface
- a //to// list of languages: either //all//, or just one
- combined text field/fridge magnet input; filter magnets by started word prefix
- a nicer way to show disambiguation (smaller font, maybe hidden by default)
- a nicer way to show disambiguation (maybe hidden by default)
Complete the missing words and phrases
@@ -138,6 +150,8 @@ Link to Google translate, for fall-back and for comparison
Feedback facility in the UI
Customizable distribution: make your own selection of the 2^15 language subsets
when downloading the phrasebook to a phone
=How to contribute=
@@ -156,12 +170,15 @@ with ``G``) are pure strings.
Here are the steps to follow for contributors:
+ Make sure you have the latest sources
from [GF Darcs http://www.grammaticalframework.org/doc/gf-developers.html], using ``darcs pull``.
from [GF Darcs http://www.grammaticalframework.org/doc/gf-developers.html],
using ``darcs pull``.
+ Also make sure that you have compiled the library by ``make present`` in ``gf/lib/src/``.
+ Work in the directory [``gf/examples/phrasebook/`` http://code.haskell.org/gf/examples/phrasebook/].
+ After you've finished your contribution, recompile the phrasebook by ``make``.
+ Work in the directory
[``gf/examples/phrasebook/`` http://code.haskell.org/gf/examples/phrasebook/].
+ After you've finished your contribution, recompile the phrasebook by ``make pgf``.
+ Save your changes in ``darcs record .`` (in the ``phrasebook`` subdirectory).
+ Make a patch file with ``darcs send -o my_phrasebook_patch``, which you can send to GF maintainers.
+ Make a patch file with ``darcs send -o my_phrasebook_patch``, which you can
send to GF maintainers.
+ (Recommended:) Test the phrasebook on your local server:
+ Go to ``gf/src/server/`` and follow the instructions in the
[project Wiki http://code.google.com/p/grammatical-framework/wiki/LaunchWebDemos].
@@ -171,18 +188,6 @@ Here are the steps to follow for contributors:
- Don't delete anything! But you are free to correct incorrect forms.
- Don't change the module structure! But you are free to add a new language.
- Don't change the module structure!
- Don't compromise quality to gain coverage: //non multa sed multum!//

View File

@@ -88,11 +88,10 @@ help = unlines $ [
" -- new paragraph",
" --! new page (in HTML, recognized by the htmls program)",
" --. end of document",
--- " --- ignore this comment line in document",
--- " {---} ignore this code line in document",
" --*[Text] Text paragraph starting with a bullet",
" --[Text] Text belongs to text paragraph",
" [Text] Text belongs to code paragraph",
" --% (in the end of a line): ignore this line",
"",
"Within a text paragraph, text enclosed between certain characters",
"is treated specially:",
@@ -143,7 +142,7 @@ pDoc time s = case dropWhile emptyOrPragma (lines s) of
paras -> Doc [] time (map pPara (grp paras))
where
grp ss = case ss of
s : rest --- | ignore s -> grp rest
s : rest | ignore s -> grp rest
| isEnd s -> []
| begComment s -> let (s1,s2) = getComment (drop 2 s : rest)
in map ("-- " ++) s1 ++ grp s2
@@ -169,17 +168,16 @@ pDoc time s = case dropWhile emptyOrPragma (lines s) of
get k con isEnd cs = con beg : pItems (drop k rest)
where (beg,rest) = span (not . isEnd) cs
ignore s = case s of
'-':'-':'-':_ -> True
'{':'-':'-':'-':'}':_ -> True
_ -> False
isEnd s = case s of
'-':'-':'.':_ -> True
_ -> False
emptyOrPragma s = all isSpace s || "--#" `isPrefixOf` s
ignore s = case reverse s of
'%':'-':'-':_ -> True
_ -> False
-- render in html
doc2html :: Doc -> String
@@ -196,7 +194,7 @@ para2html :: Paragraph -> String
para2html p = case p of
Text its -> concat (map item2html its)
Item its -> mkTagXML "li" ++ concat (map item2html its)
Code s -> unlines $ tagXML "pre" $ map (indent 2) $
Code s -> unlines $ tagXML "pre" $ map (indent 2) $ filter (not . ignore) $
remEmptyLines $ lines $ spec s
New -> mkTagXML "p"
NewPage -> mkTagXML "p" ++ "\n" ++ mkTagXML "!-- NEW --"