From 836026a3ce2cecc788cd7a169537df4a305ea339 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 21 Mar 2006 13:57:38 +0000 Subject: [PATCH] unlexer bug ; "vilka" ; lib path warning ; p -lines result --- lib/resource-1.0/Makefile | 2 +- lib/resource-1.0/doc/index.html | 111 ++++++++++++++++++-- lib/resource-1.0/doc/index.txt | 74 ++++++++++++- lib/resource-1.0/norwegian/StructuralNor.gf | 2 +- lib/resource-1.0/swedish/StructuralSwe.gf | 2 +- src/GF.hs | 20 ++-- src/GF/Shell.hs | 6 +- src/GF/Text/Text.hs | 2 +- 8 files changed, 196 insertions(+), 23 deletions(-) diff --git a/lib/resource-1.0/Makefile b/lib/resource-1.0/Makefile index 36e1e8611..cb336ed58 100644 --- a/lib/resource-1.0/Makefile +++ b/lib/resource-1.0/Makefile @@ -29,7 +29,7 @@ multimodal: mv multimodal/*.gfc multimodal/*.gfr ../multimodal compiled: - cd .. ; tar cvfz compiled.tgz alltenses/ mathematical/ multimodal/ present/ + cd .. ; tar cvfz compiled.tgz alltenses/ mathematical/ multimodal/ present/ prelude/*.gf? treebank: gf

GF Resource Grammar Library v. 1.0

Author: Aarne Ranta <aarne (at) cs.chalmers.se>
-Last update: Fri Mar 10 13:27:21 2006 +Last update: Tue Mar 21 14:49:24 2006

@@ -35,7 +35,8 @@ Last update: Fri Mar 10 13:27:21 2006
  • Tram
  • Animals -
  • More reading +
  • Known bugs and missing components +
  • More reading

    @@ -60,9 +61,12 @@ we refer to v. 0.9.

    Authors

    +Inger Andersson and Therese Soderberg (Spanish morphology), +Nicolas Barth and Sylvain Pogodalla (French verb list), Janna Khegai (Russian modules, forthcoming), Bjorn Bringert (many Swadesh lexica), Carlos Gonzalia (Spanish cardinals), +Harald Hammarstrom (German morphology), Partik Jansson (Swedish cardinals), Aarne Ranta.

    @@ -70,12 +74,16 @@ Aarne Ranta. We are grateful for contributions and comments to several other people who have used this and the previous versions of the resource library, including +Ludmilla Bogavac, Ana Bove, David Burke, Lauri Carlson, Gloria Casanellas, Karin Cavallin, +Robin Cooper, Hans-Joachim Daniels, +Elisabet Engdahl, +Markus Forsberg, Kristofer Johannisson, Anni Laine, Wanjiku Ng'ang'a, @@ -130,15 +138,26 @@ Go to the main directory, compile the grammars, and run a test.

    This will take quite some time. An alternative is to use the -precompiled grammar package. Just do +precompiled grammar package from GF download page. This package +has the necessary gfc and gfr files directly under GF/lib.

    -    cd GF/lib/resource-1.0
    -    make pretest
    +    GF/lib/alltenses
    +    GF/lib/mathematical
    +    GF/lib/multimodal
    +    GF/lib/present
     

    -For more examples, see the -Overview slides. +Do for instance +

    +
    +    cd GF/lib/
    +    gf
    +      > i -path=present:prelude present/LangEng.gfc
    +      > gr -cat=S -number=3 -cf | tb
    +
    +

    +For more examples, see the Overview slides.

    The language independent ground API

    @@ -328,6 +347,84 @@ Its purpose is to serve as a prototype for example-based grammar writing.

    +

    Known bugs and missing components

    +

    +This bugs should be fixed before the final release of v. 1.0. +

    +

    +Danish +

    +
      +
    • API 1.0 not implemented +
    + +

    +English +

    +
      +
    • only contracted negation forms +
    + +

    +Finnish +

    +
      +
    • no possessive suffixes +
    • wrong cases in passive constructions +
    + +

    +French +

    +
      +
    • only direct word order in questions +
    + +

    +German +

    +
      +
    • the Swadesh part of lexicon missing +
    • no list of irregular verbs +
    + +

    +Italian +

    +
      +
    • no contraction of infinitives before clitics +
    • no list of irregular verbs +
    + +

    +Norwegian +

    +
      +
    • word order in compound verbs sometimes wrong +
    + +

    +Russian +

    +
      +
    • API 1.0 not implemented +
    + +

    +Spanish +

    +
      +
    • no ordinal numbers +
    + +

    +Swedish +

    +
      +
    • word order in compound verbs sometimes wrong +
    + +

    More reading

    Grammars as Software Libraries. Slides diff --git a/lib/resource-1.0/doc/index.txt b/lib/resource-1.0/doc/index.txt index 8f49b612f..2d6231c39 100644 --- a/lib/resource-1.0/doc/index.txt +++ b/lib/resource-1.0/doc/index.txt @@ -25,21 +25,28 @@ we refer to [v. 0.9 ../../resource/]. ==Authors== +Inger Andersson and Therese Soderberg (Spanish morphology), +Nicolas Barth and Sylvain Pogodalla (French verb list), Janna Khegai (Russian modules, forthcoming), Bjorn Bringert (many Swadesh lexica), Carlos Gonzalia (Spanish cardinals), +Harald Hammarstrom (German morphology), Partik Jansson (Swedish cardinals), Aarne Ranta. We are grateful for contributions and comments to several other people who have used this and the previous versions of the resource library, including +Ludmilla Bogavac, Ana Bove, David Burke, Lauri Carlson, Gloria Casanellas, Karin Cavallin, +Robin Cooper, Hans-Joachim Daniels, +Elisabet Engdahl, +Markus Forsberg, Kristofer Johannisson, Anni Laine, Wanjiku Ng'ang'a, @@ -83,13 +90,22 @@ Go to the main directory, compile the grammars, and run a test. make test ``` This will take quite some time. An alternative is to use the -[precompiled grammar package ../../compiled.tgz]. Just do +precompiled grammar package from GF download page. This package +has the necessary ``gfc`` and ``gfr`` files directly under ``GF/lib``. ``` - cd GF/lib/resource-1.0 - make pretest + GF/lib/alltenses + GF/lib/mathematical + GF/lib/multimodal + GF/lib/present ``` -For more examples, see the -[Overview slides clt2006.html]. +Do for instance +``` + cd GF/lib/ + gf + > i -path=present:prelude present/LangEng.gfc + > gr -cat=S -number=3 -cf | tb +``` +For more examples, see the [Overview slides clt2006.html]. @@ -265,6 +281,54 @@ Its purpose is to serve as a prototype for example-based grammar writing. +==Known bugs and missing components== + +This bugs should be fixed before the final release of v. 1.0. + +Danish +- API 1.0 not implemented + + +English +- only contracted negation forms + + +Finnish +- no possessive suffixes +- wrong cases in passive constructions + + +French +- only direct word order in questions + + +German +- the Swadesh part of lexicon missing +- no list of irregular verbs + + +Italian +- no contraction of infinitives before clitics +- no list of irregular verbs + + +Norwegian +- word order in compound verbs sometimes wrong + + +Russian +- API 1.0 not implemented + + +Spanish +- no ordinal numbers + + +Swedish +- word order in compound verbs sometimes wrong + + + ==More reading== [Grammars as Software Libraries gslt-sem-2006.html]. Slides diff --git a/lib/resource-1.0/norwegian/StructuralNor.gf b/lib/resource-1.0/norwegian/StructuralNor.gf index dc3db69ec..9dff1e19b 100644 --- a/lib/resource-1.0/norwegian/StructuralNor.gf +++ b/lib/resource-1.0/norwegian/StructuralNor.gf @@ -107,7 +107,7 @@ concrete StructuralNor of Structural = CatNor ** whichPl_IDet = {s = \\_ => "hvilke" ; n = Pl ; det = DIndef} ; whichSg_IDet = {s = genderForms "hvilken" "hvilket" ; n = Sg ; det = DIndef} ; whoSg_IP = {s = vem.s ; gn = SgUtr} ; - whoPl_IP = {s = vem.s ; gn = Plg} ; + whoPl_IP = {s = \\_ => "hvilke" ; gn = Plg} ; why_IAdv = ss "hvorfor" ; without_Prep = ss "uten" ; with_Prep = ss "med" ; diff --git a/lib/resource-1.0/swedish/StructuralSwe.gf b/lib/resource-1.0/swedish/StructuralSwe.gf index 9e4fe3b55..f7b03b131 100644 --- a/lib/resource-1.0/swedish/StructuralSwe.gf +++ b/lib/resource-1.0/swedish/StructuralSwe.gf @@ -106,7 +106,7 @@ concrete StructuralSwe of Structural = CatSwe ** whichPl_IDet = {s = \\_ => "vilka" ; n = Pl ; det = DIndef} ; whichSg_IDet = {s = genderForms "vilken" "vilket" ; n = Sg ; det = DIndef} ; whoSg_IP = {s = vem.s ; gn = SgUtr} ; - whoPl_IP = {s = vem.s ; gn = Plg} ; + whoPl_IP = {s = \\_ => "vilka" ; gn = Plg} ; why_IAdv = ss "varför" ; without_Prep = ss "utan" ; with_Prep = ss "med" ; diff --git a/src/GF.hs b/src/GF.hs index 8fcd219b0..478a40d3f 100644 --- a/src/GF.hs +++ b/src/GF.hs @@ -31,11 +31,11 @@ import GF.Text.UTF8 import GF.Today (today,version) import GF.System.Arch -import System (getArgs,system) +import System (getArgs,system,getEnv) import Control.Monad (foldM,liftM) import Data.List (nub) --- AR 19/4/2000 -- 28/4/2005 +-- AR 19/4/2000 -- 21/3/2006 main :: IO () main = do @@ -52,7 +52,8 @@ main = do putStrLnFlush $ encodeUTF8 helpMsg _ | opt forJava -> do - putStrLnFlush $ encodeUTF8 welcomeMsg + welcome <- welcomeMsgLib + putStrLnFlush $ encodeUTF8 welcome st <- useIOE st0 $ foldM (shellStateFromFiles os) st0 fs sessionLineJ True st @@ -77,8 +78,8 @@ main = do if opt beSilent then return () else putStrLnFlush "" return () _ -> do - - ifNotSil $ putStrLnFlush $ welcomeMsg + welcome <- welcomeMsgLib + ifNotSil $ putStrLnFlush $ welcome st <- useIOE st0 $ foldM (shellStateFromFiles os) st0 fs if null fs then return () else (ifNotSil putCPU) @@ -110,9 +111,16 @@ helpMsg = unlines [ "which suppresses all messages except the output and fatal errors." ] -welcomeMsg = +welcomeMsgLib = do + lib <- catch + (getEnv "GF_LIB_PATH" >>= return . ("GF_LIB_PATH is set to" +++)) + (const (return "Warning: GF_LIB_PATH is not defined.")) + return $ welcomeMsg lib + +welcomeMsg lib = "Welcome to " ++ authorMsg ++++ "If ä and ö (umlaut letters) look strange, see 'h -coding'." ++ + "\n" ++ lib ++ "\n\nType 'h' for help, and 'h [Command] for more detailed help.\n" authorMsg = unlines [ diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs index 1077616f5..3af343bb2 100644 --- a/src/GF/Shell.hs +++ b/src/GF/Shell.hs @@ -24,6 +24,7 @@ import qualified GF.Grammar.Lookup as L import qualified GF.Canon.GFC as GFC import qualified GF.Canon.Look as Look import qualified GF.Canon.CMacros as CMacros +import qualified GF.Grammar.MMacros as MMacros import qualified GF.Compile.GrammarToCanon as GrammarToCanon import GF.Grammar.Values import GF.UseGrammar.GetTree @@ -236,7 +237,10 @@ execC co@(comm, opts0) sa@(sh@(st,(h,_,_,_)),a) = checkOptions st co >> case com let ss = (if oElem showAll opts then id else filter (not . null)) $ lines $ prCommandArg a mts <- mapM parse ss - let a' = ATrms [t | (_,ATrms ts) <- mts, t <- ts] + let mark s ts = case ts of + [] -> [MMacros.uTree] -- to leave a trace of unparsed line + _ -> ts + let a' = ATrms [t | (s,(_,ATrms ts)) <- zip ss mts, t <- mark s ts] changeArg (const a') sa | otherwise -> parse $ prCommandArg a where diff --git a/src/GF/Text/Text.hs b/src/GF/Text/Text.hs index 3e1b9c46d..a2a69f70c 100644 --- a/src/GF/Text/Text.hs +++ b/src/GF/Text/Text.hs @@ -60,7 +60,7 @@ formatAsCodeLit :: String -> String formatAsCodeLit = formatAsCode . unwords . map unStringLit . words formatAsText,formatAsHTML,formatAsLatex :: String -> String -formatAsText = formatAsTextGen (=="&-") (=="&-") +formatAsText = formatAsTextGen (const False) (=="&-") formatAsHTML = formatAsTextGen (\s -> take 1 s == "<" || last s == '>') (const False) formatAsLatex = formatAsTextGen ((=="\\") . take 1) (const False)