forked from GitHub/gf-core
resource.txt updates ; lock field and lookup book fixes
This commit is contained in:
BIN
doc/resource.pdf
BIN
doc/resource.pdf
Binary file not shown.
389
doc/resource.txt
389
doc/resource.txt
@@ -15,6 +15,7 @@ Last update: %%date(%c)
|
||||
%!postproc(tex): "#ECENTER" "end{center}"
|
||||
%!postproc(tex): "#CAPTION" "caption{"
|
||||
%!postproc(tex): "#RBRACE" "end{figure}"
|
||||
%!postproc(tex): "#CLEARPAGE" "clearpage"
|
||||
|
||||
%!target:tex
|
||||
|
||||
@@ -95,7 +96,8 @@ variation is taken care of by the resource grammar function
|
||||
```
|
||||
fun AdjCN : AP -> CN -> CN
|
||||
```
|
||||
The resource grammar implementation of the rule adding properties
|
||||
(see the tables in the end of this document for the list of all resource grammar
|
||||
functions). The resource grammar implementation of the rule adding properties
|
||||
to kinds is
|
||||
```
|
||||
lin PropKind kind prop = AdjCN prop kind
|
||||
@@ -248,6 +250,46 @@ gives its own definition of this function:
|
||||
}
|
||||
```
|
||||
|
||||
==Lock fields==
|
||||
|
||||
When the categories of the resource grammar are used
|
||||
in applications, a **lock field** is added to their linearization types.
|
||||
The lock field makes the linearization type of each category
|
||||
unique, so that categories
|
||||
with the same implementation are not confused with each other.
|
||||
(This is inspired by the ``newtype`` discipline in Haskell.)
|
||||
For instance, the lincats of adverbs and conjunctions are the same
|
||||
in ``CatEng`` (and therefore in ``GrammarEng``, which inherits it):
|
||||
```
|
||||
lincat Adv = {s : Str} ;
|
||||
lincat Conj = {s : Str} ;
|
||||
```
|
||||
But when these category symbols are used to denote their linearization
|
||||
types in an application, these definitions are translated to
|
||||
```
|
||||
oper Adv : Type = {s : Str ; lock_Adv : {}} ;
|
||||
oper Conj : Type = {s : Str} ; lock_Conj : {}} ;
|
||||
```
|
||||
In this way, the user of a resource grammar cannot confuse adverbs with
|
||||
conjunctions. In other words, the lock fields force the type checker
|
||||
to function as grammaticality checker.
|
||||
|
||||
When the resource grammar is ``open``ed in an application grammar,
|
||||
and only functions from the resource are used in type-correct way, the
|
||||
lock fields are never seen (except possibly in type error messages).
|
||||
If an application grammarian has to write lock fields herself,
|
||||
it is a sign that the guarantees given by the resource grammar
|
||||
no longer hold. But since the resource may be incomplete, the
|
||||
application grammarian may occasionally have to provide the dummy
|
||||
values of lock fields (always ``<>``, the empty record).
|
||||
Here is an example:
|
||||
```
|
||||
mkUtt : Str -> Utt ;
|
||||
mkUtt s = {s = s ; lock_Utt = <>} ;
|
||||
```
|
||||
Currently, missing lock field produce warnings rather than errors,
|
||||
but this behaviour of GF may change in future.
|
||||
|
||||
|
||||
==Parsing with resource grammars?==
|
||||
|
||||
@@ -906,60 +948,67 @@ has only been exploited in a very small scale so far.
|
||||
%!include: ../lib/resource-1.0/swedish/ParadigmsSwe.txt
|
||||
|
||||
|
||||
|
||||
#SMALL
|
||||
#CLEARPAGE
|
||||
|
||||
=Summary of Categories and Functions=
|
||||
|
||||
These tables show all categories and functions in ``Grammar``,
|
||||
except the functions in ``Structural``.
|
||||
All example strings can be parsed in ``LangEng``.
|
||||
|
||||
|
||||
==Categories==
|
||||
|
||||
|
||||
#SMALL
|
||||
|
||||
|| Category | Module | Explanation | Example |
|
||||
| A2 | Cat | two place adjective | "divisible"
|
||||
| A | Cat | one place adjective | "warm"
|
||||
| A2 | Cat | two place adjective | "married"
|
||||
| A | Cat | one place adjective | "old"
|
||||
| AdA | Common | adjective modifying adverb, | "very"
|
||||
| AdN | Common | numeral modifying adverb, | "more than"
|
||||
| AdV | Common | adverb directly attached to verb | "always"
|
||||
| Adv | Common | verb phrase modifying adverb, | "in the house"
|
||||
| Ant | Common | anteriority | simultaneous
|
||||
| AP | Cat | adjectival phrase | "very warm"
|
||||
| AP | Cat | adjectival phrase | "very old"
|
||||
| CAdv | Common | comparative adverb | "more"
|
||||
| Cl | Cat | declarative clause, with all tenses | "she looks at this"
|
||||
| Cl | Cat | declarative clause, with all tenses | "she walks"
|
||||
| CN | Cat | common noun (without determiner) | "red house"
|
||||
| Comp | Cat | complement of copula, such as AP | "very warm"
|
||||
| Conj | Cat | conjunction, | "and"
|
||||
| DConj | Cat | distributed conj. | "both and"
|
||||
| Det | Cat | determiner phrase | "all the seven"
|
||||
| DConj | Cat | distributed conj. | "both" - "and"
|
||||
| Det | Cat | determiner phrase | "these seven"
|
||||
| Digit | Numeral | digit from 2 to 9 | "4"
|
||||
| IAdv | Common | interrogative adverb | "why"
|
||||
| IComp | Cat | interrogative complement of copula | "where"
|
||||
| IDet | Cat | interrogative determiner | "which"
|
||||
| Imp | Cat | imperative | "look at this"
|
||||
| IP | Cat | interrogative pronoun | "who"
|
||||
| N2 | Cat | relational noun | "son"
|
||||
| N2 | Cat | relational noun | "brother"
|
||||
| N3 | Cat | three place relational noun | "connection"
|
||||
| N | Cat | common noun | "house"
|
||||
| NP | Cat | noun phrase (subject or object) | "the red house"
|
||||
| Num | Cat | cardinal number (used with QuantPl) | "seven"
|
||||
| Numeral | Cat | cardinal or ordinal, | "five/fifth"
|
||||
| Numeral | Cat | cardinal or ordinal, | "five" / "fifth"
|
||||
| Ord | Cat | ordinal number (used in Det) | "seventh"
|
||||
| PConj | Common | phrase beginning conj. | "therefore"
|
||||
| Phr | Common | phrase in a text | "but be quiet please"
|
||||
| Phr | Common | phrase in a text | "but look at this please"
|
||||
| PN | Cat | proper name | "Paris"
|
||||
| Pol | Common | polarity | positive
|
||||
| Predet | Cat | predeterminer (prefixed Quant) | "all"
|
||||
| Prep | Cat | preposition, or just case | "in"
|
||||
| Pron | Cat | personal pronoun | "she"
|
||||
| QCl | Cat | question clause, with all tenses | "why does she walk"
|
||||
| QS | Cat | question | "where did she live"
|
||||
| Quant | Cat | quantifier with both sg and pl | "this/these"
|
||||
| QS | Cat | question | "where did she walk"
|
||||
| Quant | Cat | quantifier with both sg and pl | "this"/"these"
|
||||
| QuantPl | Cat | quantifier ('nucleus' of plur. Det) | "many"
|
||||
| QuantSg | Cat | quantifier ('nucleus' of sing. Det) | "every"
|
||||
| RCl | Cat | relative clause, with all tenses | "in which she lives"
|
||||
| RCl | Cat | relative clause, with all tenses | "in which she walks"
|
||||
| RP | Cat | relative pronoun | "in which"
|
||||
| RS | Cat | relative | "in which she lived"
|
||||
| S | Cat | declarative sentence | "she lived here"
|
||||
| RS | Cat | relative | "that she loves"
|
||||
| S | Cat | declarative sentence | "she was here"
|
||||
| SC | Common | embedded sentence or question | "that it rains"
|
||||
| Slash | Cat | clause missing NP (S/NP in GPSG) | "she looks at"
|
||||
| Slash | Cat | clause missing NP (S/NP in GPSG) | "she loves"
|
||||
|
||||
|
||||
|| Category | Module | Explanation | Example |
|
||||
@@ -992,174 +1041,174 @@ has only been exploited in a very small scale so far.
|
||||
|| Function | Module | Type | Example |
|
||||
| AAnter | Common | Ant | ""
|
||||
| ASimul | Common | Ant | ""
|
||||
| AdAdv | Adverb | AdA -> Adv -> Adv | very quickly
|
||||
| AdAP | Adjective | AdA -> AP -> AP | very uncertain
|
||||
| AdjCN | Noun | AP -> CN -> CN | big house
|
||||
| AdnCAdv | Adverb | CAdv -> AdN | more (than five)
|
||||
| AdNum | Noun | AdN -> Num -> Num | almost 51
|
||||
| AdvCN | Noun | CN -> Adv -> CN | house on the hill
|
||||
| AdvIP | Question | IP -> Adv -> IP | who in Europe
|
||||
| AdvNP | Noun | NP -> Adv -> NP | Paris at midnight
|
||||
| AdvSC | Adverb | SC -> Adv | that he arrives
|
||||
| AdvSlash | Sentence | Slash -> Adv -> Slash | (whom) he sees tomorrow
|
||||
| AdVVP | Verb | AdV -> VP -> VP | always sleep
|
||||
| AdvVP | Verb | VP -> Adv -> VP | sleep here
|
||||
| ApposCN | Noun | CN -> NP -> CN | number x, numbers x and y
|
||||
| BaseAdv | Conjunction | Adv -> Adv -> [Adv] | "here, today"
|
||||
| BaseAP | Conjunction | AP -> AP -> [AP] | "even, odd"
|
||||
| BaseNP | Conjunction | NP -> NP -> [NP] | "John, Mary"
|
||||
| BaseS | Conjunction | S -> S -> [S] | "I walk, you run"
|
||||
| CleftAdv | Idiom | Adv -> S -> Cl | it is yesterday she arrived
|
||||
| CleftNP | Idiom | NP -> RS -> Cl | it is you who did it
|
||||
| CompAdv | Verb | Adv -> Comp | (be) here
|
||||
| CompAP | Verb | AP -> Comp | (be) small
|
||||
| ComparA | Adjective | A -> NP -> AP | warmer than Spain
|
||||
| ComparAdvAdj | Adverb | CAdv -> A -> NP -> Adv | more quickly than John
|
||||
| ComparAdvAdjS | Adverb | CAdv -> A -> S -> Adv | more quickly than he runs
|
||||
| AdAdv | Adverb | AdA -> Adv -> Adv | "very"
|
||||
| AdAP | Adjective | AdA -> AP -> AP | "very old"
|
||||
| AdjCN | Noun | AP -> CN -> CN | "big house"
|
||||
| AdnCAdv | Adverb | CAdv -> AdN | "more than"
|
||||
| AdNum | Noun | AdN -> Num -> Num | "almost ten"
|
||||
| AdvCN | Noun | CN -> Adv -> CN | "house on the mountain"
|
||||
| AdvIP | Question | IP -> Adv -> IP | "who in Paris"
|
||||
| AdvNP | Noun | NP -> Adv -> NP | "Paris without wine"
|
||||
| AdvSC | Adverb | SC -> Adv | "that he sleeps"
|
||||
| AdvSlash | Sentence | Slash -> Adv -> Slash | "she sees here"
|
||||
| AdVVP | Verb | AdV -> VP -> VP | "always sleep"
|
||||
| AdvVP | Verb | VP -> Adv -> VP | "sleep here"
|
||||
| ApposCN | Noun | CN -> NP -> CN | "number x"
|
||||
| BaseAdv | Conjunction | Adv -> Adv -> [Adv] | "here" - "today"
|
||||
| BaseAP | Conjunction | AP -> AP -> [AP] | "even" - "odd"
|
||||
| BaseNP | Conjunction | NP -> NP -> [NP] | "the car" - "the house"
|
||||
| BaseS | Conjunction | S -> S -> [S] | "I walk" - "you run"
|
||||
| CleftAdv | Idiom | Adv -> S -> Cl | "it is here that she sleeps"
|
||||
| CleftNP | Idiom | NP -> RS -> Cl | "it is she who sleeps"
|
||||
| CompAdv | Verb | Adv -> Comp | "here"
|
||||
| CompAP | Verb | AP -> Comp | "old"
|
||||
| ComparA | Adjective | A -> NP -> AP | "warmer than the house"
|
||||
| ComparAdvAdj | Adverb | CAdv -> A -> NP -> Adv | "more heavily than Paris"
|
||||
| ComparAdvAdjS | Adverb | CAdv -> A -> S -> Adv | "more heavily than she sleeps"
|
||||
|
||||
|
||||
|| Function | Module | Type | Example |
|
||||
| CompIAdv | Question | IAdv -> IComp | where
|
||||
| ComplA2 | Adjective | A2 -> NP -> AP | divisible by 2
|
||||
| ComplN2 | Noun | N2 -> NP -> CN | son of the king
|
||||
| ComplN3 | Noun | N3 -> NP -> N2 | flight from Moscow (to Paris)
|
||||
| ComplV2A | Verb | V2A -> NP -> AP -> VP | paint the house red
|
||||
| ComplV2 | Verb | V2 -> NP -> VP | use it
|
||||
| ComplV3 | Verb | V3 -> NP -> NP -> VP | send a message to her
|
||||
| ComplVA | Verb | VA -> AP -> VP | look red
|
||||
| ComplVQ | Verb | VQ -> QS -> VP | ask if she runs
|
||||
| ComplVS | Verb | VS -> S -> VP | know that she runs
|
||||
| ComplVV | Verb | VV -> VP -> VP | want to run
|
||||
| CompNP | Verb | NP -> Comp | (be) a soldier
|
||||
| ConjAdv | Conjunction | Conj -> [Adv] -> Adv | quickly or slowly
|
||||
| ConjAP | Conjunction | Conj -> [AP] -> AP | even and prime
|
||||
| ConjNP | Conjunction | Conj -> [NP] -> NP | John or Mary
|
||||
| ConjS | Conjunction | Conj -> [S] -> S | John walks and Mary runs
|
||||
| ConsAdv | Conjunction | Adv -> [Adv] -> [Adv] | "here, today, with us"
|
||||
| ConsAP | Conjunction | AP -> [AP] -> [AP] | "even, odd, prime"
|
||||
| ConsNP | Conjunction | NP -> [NP] -> [NP] | "John, Mary, you"
|
||||
| ConsS | Conjunction | S -> [S] -> [S] | "I walk, you run, he sleeps"
|
||||
| DConjAdv | Conjunction | DConj -> [Adv] -> Adv | both badly and slowly
|
||||
| DConjAP | Conjunction | DConj -> [AP] -> AP | both even and prime
|
||||
| DConjNP | Conjunction | DConj -> [NP] -> NP | either John or Mary
|
||||
| DConjS | Conjunction | DConj -> [S] -> S | either John walks or Mary runs
|
||||
| DefArt | Noun | Quant | the (house), the (houses)
|
||||
| DetCN | Noun | Det -> CN -> NP | the man
|
||||
| DetPl | Noun | QuantPl -> Num -> Ord -> Det | these five best men
|
||||
| DetSg | Noun | QuantSg -> Ord -> Det | this best man
|
||||
| EmbedQS | Sentence | QS -> SC | whether you go
|
||||
| EmbedS | Sentence | S -> SC | that you go
|
||||
| EmbedVP | Sentence | VP -> SC | to go
|
||||
| ExistIP | Idiom | IP -> QCl | which houses are there
|
||||
| ExistNP | Idiom | NP -> Cl | there is a house
|
||||
| FunRP | Relative | Prep -> NP -> RP -> RP | all the roots of which
|
||||
| GenericCl | Idiom | VP -> Cl | one sleeps
|
||||
| IDetCN | Question | IDet -> Num -> Ord -> CN -> IP | which five best songs
|
||||
| IdRP | Relative | RP | which
|
||||
| ImpersCl | Idiom | VP -> Cl | it rains
|
||||
| ImpPl1 | Idiom | VP -> Utt | let's go
|
||||
| ImpVP | Sentence | VP -> Imp | go
|
||||
| IndefArt | Noun | Quant | a (house), (houses)
|
||||
| MassDet | Noun | QuantSg | (beer)
|
||||
| CompIAdv | Question | IAdv -> IComp | "where"
|
||||
| ComplA2 | Adjective | A2 -> NP -> AP | "married to her"
|
||||
| ComplN2 | Noun | N2 -> NP -> CN | "brother of the woman"
|
||||
| ComplN3 | Noun | N3 -> NP -> N2 | "connection from that city to Paris"
|
||||
| ComplV2A | Verb | V2A -> NP -> AP -> VP | "paint the house red"
|
||||
| ComplV2 | Verb | V2 -> NP -> VP | "love it"
|
||||
| ComplV3 | Verb | V3 -> NP -> NP -> VP | "send flowers to us"
|
||||
| ComplVA | Verb | VA -> AP -> VP | "become red"
|
||||
| ComplVQ | Verb | VQ -> QS -> VP | "ask if she runs"
|
||||
| ComplVS | Verb | VS -> S -> VP | "say that she runs"
|
||||
| ComplVV | Verb | VV -> VP -> VP | "want to run"
|
||||
| CompNP | Verb | NP -> Comp | "a man"
|
||||
| ConjAdv | Conjunction | Conj -> [Adv] -> Adv | "here or in the car"
|
||||
| ConjAP | Conjunction | Conj -> [AP] -> AP | "warm or cold"
|
||||
| ConjNP | Conjunction | Conj -> [NP] -> NP | "the man or the woman"
|
||||
| ConjS | Conjunction | Conj -> [S] -> S | "he walks or she runs"
|
||||
| ConsAdv | Conjunction | Adv -> [Adv] -> [Adv] | "here" - "without them, with us"
|
||||
| ConsAP | Conjunction | AP -> [AP] -> [AP] | "warm" - "red, old"
|
||||
| ConsNP | Conjunction | NP -> [NP] -> [NP] | "she" - "you, I"
|
||||
| ConsS | Conjunction | S -> [S] -> [S] | "I walk" - "she runs, he sleeps"
|
||||
| DConjAdv | Conjunction | DConj -> [Adv] -> Adv | "either here or there"
|
||||
| DConjAP | Conjunction | DConj -> [AP] -> AP | "either warm or cold"
|
||||
| DConjNP | Conjunction | DConj -> [NP] -> NP | "either the man or the woman"
|
||||
| DConjS | Conjunction | DConj -> [S] -> S | "either he walks or she runs"
|
||||
| DefArt | Noun | Quant | "the"
|
||||
| DetCN | Noun | Det -> CN -> NP | "the man"
|
||||
| DetPl | Noun | QuantPl -> Num -> Ord -> Det | "the five best"
|
||||
| DetSg | Noun | QuantSg -> Ord -> Det | "this"
|
||||
| EmbedQS | Sentence | QS -> SC | "whom she loves"
|
||||
| EmbedS | Sentence | S -> SC | "that you go"
|
||||
| EmbedVP | Sentence | VP -> SC | "to love it"
|
||||
| ExistIP | Idiom | IP -> QCl | "which cars are there"
|
||||
| ExistNP | Idiom | NP -> Cl | "there is a car"
|
||||
| FunRP | Relative | Prep -> NP -> RP -> RP | "all houses in which"
|
||||
| GenericCl | Idiom | VP -> Cl | "one sleeps"
|
||||
| IDetCN | Question | IDet -> Num -> Ord -> CN -> IP | "which five hottest songs"
|
||||
| IdRP | Relative | RP | "which"
|
||||
| ImpersCl | Idiom | VP -> Cl | "it rains"
|
||||
| ImpPl1 | Idiom | VP -> Utt | "let's go"
|
||||
| ImpVP | Sentence | VP -> Imp | "go to the house"
|
||||
| IndefArt | Noun | Quant | "a"
|
||||
| MassDet | Noun | QuantSg | ("beer")
|
||||
| NoNum | Noun | Num | ""
|
||||
| NoOrd | Noun | Ord | ""
|
||||
| NoPConj | Phrase | PConj | ""
|
||||
| NoVoc | Phrase | Voc | ""
|
||||
| NumInt | Noun | Int -> Num | 51
|
||||
| NumNumeral | Noun | Numeral -> Num | fifty-one
|
||||
| OrdInt | Noun | Int -> Ord | 51st
|
||||
| OrdNumeral | Noun | Numeral -> Ord | fifty-first
|
||||
| OrdSuperl | Noun | A -> Ord | largest
|
||||
| PassV2 | Verb | V2 -> VP | be used
|
||||
| PConjConj | Phrase | Conj -> PConj | and
|
||||
| PhrUtt | Phrase | PConj -> Utt -> Voc -> Phr | But go home my friend.
|
||||
| PlQuant | Noun | Quant -> QuantPl | these
|
||||
| PositA | Adjective | A -> AP | warm
|
||||
| PositAdvAdj | Adverb | A -> Adv | quickly
|
||||
| NumInt | Noun | Int -> Num | "51"
|
||||
| NumNumeral | Noun | Numeral -> Num | "five hundred"
|
||||
| OrdInt | Noun | Int -> Ord | "13 th"
|
||||
| OrdNumeral | Noun | Numeral -> Ord | "thirteenth"
|
||||
| OrdSuperl | Noun | A -> Ord | "hottest"
|
||||
| PassV2 | Verb | V2 -> VP | "be seen"
|
||||
| PConjConj | Phrase | Conj -> PConj | "and"
|
||||
| PhrUtt | Phrase | PConj -> Utt -> Voc -> Phr | "but come here please"
|
||||
| PlQuant | Noun | Quant -> QuantPl | "these"
|
||||
| PositA | Adjective | A -> AP | "warm"
|
||||
| PositAdvAdj | Adverb | A -> Adv | "warmly"
|
||||
|
||||
|| Function | Module | Type | Example |
|
||||
| PossPron | Noun | Pron -> Quant | my (house)
|
||||
| PPartNP | Noun | NP -> V2 -> NP | the number squared
|
||||
| PossPron | Noun | Pron -> Quant | "my"
|
||||
| PPartNP | Noun | NP -> V2 -> NP | "the city seen"
|
||||
| PNeg | Common | Pol | ""
|
||||
| PPos | Common | Pol | ""
|
||||
| PredetNP | Noun | Predet -> NP -> NP | only the man
|
||||
| PredSCVP | Sentence | SC -> VP -> Cl | that you go makes me happy
|
||||
| PredVP | Sentence | NP -> VP -> Cl | John walks
|
||||
| PrepIP | Question | Prep -> IP -> IAdv | with whom
|
||||
| PrepNP | Adverb | Prep -> NP -> Adv | in the house
|
||||
| ProgrVP | Idiom | VP -> VP | be sleeping
|
||||
| QuestCl | Question | Cl -> QCl | does John walk
|
||||
| QuestIAdv | Question | IAdv -> Cl -> QCl | why does John walk
|
||||
| QuestIComp | Question | IComp -> NP -> QCl | where is John
|
||||
| QuestSlash | Question | IP -> Slash -> QCl | who does John love
|
||||
| QuestVP | Question | IP -> VP -> QCl | who walks
|
||||
| ReflA2 | Adjective | A2 -> AP | divisible by itself
|
||||
| ReflV2 | Verb | V2 -> VP | use itself
|
||||
| RelCl | Relative | Cl -> RCl | such that John loves her
|
||||
| RelCN | Noun | CN -> RS -> CN | house that John owns
|
||||
| RelSlash | Relative | RP -> Slash -> RCl | whom John loves
|
||||
| RelVP | Relative | RP -> VP -> RCl | who loves John
|
||||
| SentAP | Adjective | AP -> SC -> AP | great that she won, uncertain if she did
|
||||
| SentCN | Noun | CN -> SC -> CN | fact that John smokes, question if he does
|
||||
| SgQuant | Noun | Quant -> QuantSg | this
|
||||
| SlashPrep | Sentence | Cl -> Prep -> Slash | (with whom) he walks
|
||||
| SlashV2 | Sentence | NP -> V2 -> Slash | (whom) he sees
|
||||
| SlashVVV2 | Sentence | NP -> VV -> V2 -> Slash | (whom) he wants to see
|
||||
| SubjS | Adverb | Subj -> S -> Adv | when he arrives
|
||||
| PredetNP | Noun | Predet -> NP -> NP | "only the man"
|
||||
| PredSCVP | Sentence | SC -> VP -> Cl | "that she sleeps is good"
|
||||
| PredVP | Sentence | NP -> VP -> Cl | "she walks"
|
||||
| PrepIP | Question | Prep -> IP -> IAdv | "with whom"
|
||||
| PrepNP | Adverb | Prep -> NP -> Adv | "in the house"
|
||||
| ProgrVP | Idiom | VP -> VP | "be sleeping"
|
||||
| QuestCl | Question | Cl -> QCl | "does she walk"
|
||||
| QuestIAdv | Question | IAdv -> Cl -> QCl | "why does she walk"
|
||||
| QuestIComp | Question | IComp -> NP -> QCl | "where is she"
|
||||
| QuestSlash | Question | IP -> Slash -> QCl | "whom does she love"
|
||||
| QuestVP | Question | IP -> VP -> QCl | "who walks"
|
||||
| ReflA2 | Adjective | A2 -> AP | "married to itself"
|
||||
| ReflV2 | Verb | V2 -> VP | "see himself"
|
||||
| RelCl | Relative | Cl -> RCl | "such that she loves him"
|
||||
| RelCN | Noun | CN -> RS -> CN | "house that she buys"
|
||||
| RelSlash | Relative | RP -> Slash -> RCl | "that she loves"
|
||||
| RelVP | Relative | RP -> VP -> RCl | "that loves her"
|
||||
| SentAP | Adjective | AP -> SC -> AP | "good that she came"
|
||||
| SentCN | Noun | CN -> SC -> CN | "fact that she smokes"
|
||||
| SgQuant | Noun | Quant -> QuantSg | "this"
|
||||
| SlashPrep | Sentence | Cl -> Prep -> Slash | (with whom) "he walks"
|
||||
| SlashV2 | Sentence | NP -> V2 -> Slash | (whom) "he sees"
|
||||
| SlashVVV2 | Sentence | NP -> VV -> V2 -> Slash | (whom) "he wants to see"
|
||||
| SubjS | Adverb | Subj -> S -> Adv | "when he came"
|
||||
| TCond | Common | Tense | ""
|
||||
| TEmpty | Text | Text | ""
|
||||
| TFut | Common | Tense | ""
|
||||
| TExclMark | Text | Phr -> Text -> Text | John walks! ...
|
||||
| TFullStop | Text | Phr -> Text -> Text | John walks. ...
|
||||
| TExclMark | Text | Phr -> Text -> Text | "She walks!"
|
||||
| TFullStop | Text | Phr -> Text -> Text | "She walks."
|
||||
| TPast | Common | Tense | ""
|
||||
| TPres | Common | Tense | ""
|
||||
| TQuestMark | Text | Phr -> Text -> Text | Are you OK? ...
|
||||
| UseA2 | Adjective | A2 -> A | divisible
|
||||
| UseCl | Sentence | Tense -> Ant -> Pol -> Cl -> S | John hadn't walked
|
||||
| UseComp | Verb | Comp -> VP | be warm
|
||||
| UseN2 | Noun | N2 -> CN | son
|
||||
| UseN3 | Noun | N3 -> CN | flight
|
||||
| UseN | Noun | N -> CN | house
|
||||
| UsePN | Noun | PN -> NP | John
|
||||
| UsePron | Noun | Pron -> NP | he
|
||||
| UseQCl | Sentence | Tense -> Ant -> Pol -> QCl -> QS | where hadn't he walked
|
||||
| UseRCl | Sentence | Tense -> Ant -> Pol -> RCl -> RS | that he hadn't met
|
||||
| UseVQ | Verb | VQ -> V2 | ask (a question)
|
||||
| UseVS | Verb | VS -> V2 | know (a secret)
|
||||
| UseV | Verb | V -> VP | sleep
|
||||
| UttAdv | Phrase | Adv -> Utt | here
|
||||
| UttIAdv | Phrase | IAdv -> Utt | why
|
||||
| UttImpPl | Phrase | Pol -> Imp -> Utt | (don't) help yourselves
|
||||
| UttImpSg | Phrase | Pol -> Imp -> Utt | (don't) help yourself
|
||||
| UttIP | Phrase | IP -> Utt | who
|
||||
| UttNP | Phrase | NP -> Utt | this man
|
||||
| UttQS | Phrase | QS -> Utt | is it good
|
||||
| UttS | Phrase | S -> Utt | John walks
|
||||
| UttVP | Phrase | VP -> Utt | to sleep
|
||||
| VocNP | Phrase | NP -> Voc | my friend
|
||||
| TQuestMark | Text | Phr -> Text -> Text | "Does she walk?"
|
||||
| UseA2 | Adjective | A2 -> A | "married"
|
||||
| UseCl | Sentence | Tense -> Ant -> Pol -> Cl -> S | "she wouldn't have walked"
|
||||
| UseComp | Verb | Comp -> VP | "be warm"
|
||||
| UseN2 | Noun | N2 -> CN | "brother"
|
||||
| UseN3 | Noun | N3 -> CN | "connection"
|
||||
| UseN | Noun | N -> CN | "house"
|
||||
| UsePN | Noun | PN -> NP | "Paris"
|
||||
| UsePron | Noun | Pron -> NP | "she"
|
||||
| UseQCl | Sentence | Tense -> Ant -> Pol -> QCl -> QS | "where hadn't she walked"
|
||||
| UseRCl | Sentence | Tense -> Ant -> Pol -> RCl -> RS | "that she hadn't seen"
|
||||
| UseVQ | Verb | VQ -> V2 | "ask" (a question)
|
||||
| UseVS | Verb | VS -> V2 | "know" (a secret)
|
||||
| UseV | Verb | V -> VP | "sleep"
|
||||
| UttAdv | Phrase | Adv -> Utt | "here"
|
||||
| UttIAdv | Phrase | IAdv -> Utt | "why"
|
||||
| UttImpPl | Phrase | Pol -> Imp -> Utt | "love yourselves"
|
||||
| UttImpSg | Phrase | Pol -> Imp -> Utt | "love yourself"
|
||||
| UttIP | Phrase | IP -> Utt | "who"
|
||||
| UttNP | Phrase | NP -> Utt | "this man"
|
||||
| UttQS | Phrase | QS -> Utt | "is it good"
|
||||
| UttS | Phrase | S -> Utt | "she walks"
|
||||
| UttVP | Phrase | VP -> Utt | "to sleep"
|
||||
| VocNP | Phrase | NP -> Voc | "my brother"
|
||||
|
||||
|| Function | Module | Type | Example |
|
||||
| num | Numeral | Sub1000000 -> Numeral | 2
|
||||
| n2 | Numeral | Digit | 2
|
||||
| n3 | Numeral | Digit | 3
|
||||
| n4 | Numeral | Digit | 4
|
||||
| n5 | Numeral | Digit | 5
|
||||
| n6 | Numeral | Digit | 6
|
||||
| n7 | Numeral | Digit | 7
|
||||
| n8 | Numeral | Digit | 8
|
||||
| n9 | Numeral | Digit | 9
|
||||
| pot01 | Numeral | Sub10 | 1
|
||||
| pot0 | Numeral | Digit -> Sub10 | 3
|
||||
| pot110 | Numeral | Sub100 | 10
|
||||
| pot111 | Numeral | Sub100 | 11
|
||||
| pot1to19 | Numeral | Digit -> Sub100 | 18
|
||||
| pot0as1 | Numeral | Sub10 -> Sub100 | 3
|
||||
| pot1 | Numeral | Digit -> Sub100 | 50
|
||||
| pot1plus | Numeral | Digit -> Sub10 -> Sub100 | 54
|
||||
| pot1as2 | Numeral | Sub100 -> Sub1000 | 99
|
||||
| pot2 | Numeral | Sub10 -> Sub1000 | 600
|
||||
| pot2plus | Numeral | Sub10 -> Sub100 -> Sub1000 | 623
|
||||
| pot2as3 | Numeral | Sub1000 -> Sub1000000 | coercion of 1..999
|
||||
| pot3 | Numeral | Sub1000 -> Sub1000000 | m * 1000
|
||||
| pot3plus | Numeral | Sub1000 -> Sub1000 -> Sub1000000 | m * 1000 + n
|
||||
| num | Numeral | Sub1000000 -> Numeral | "2"
|
||||
| n2 | Numeral | Digit | "2"
|
||||
| n3 | Numeral | Digit | "3"
|
||||
| n4 | Numeral | Digit | "4"
|
||||
| n5 | Numeral | Digit | "5"
|
||||
| n6 | Numeral | Digit | "6"
|
||||
| n7 | Numeral | Digit | "7"
|
||||
| n8 | Numeral | Digit | "8"
|
||||
| n9 | Numeral | Digit | "9"
|
||||
| pot01 | Numeral | Sub10 | "1"
|
||||
| pot0 | Numeral | Digit -> Sub10 | "3"
|
||||
| pot110 | Numeral | Sub100 | "10"
|
||||
| pot111 | Numeral | Sub100 | "11"
|
||||
| pot1to19 | Numeral | Digit -> Sub100 | "18"
|
||||
| pot0as1 | Numeral | Sub10 -> Sub100 | "3"
|
||||
| pot1 | Numeral | Digit -> Sub100 | "50"
|
||||
| pot1plus | Numeral | Digit -> Sub10 -> Sub100 | "54"
|
||||
| pot1as2 | Numeral | Sub100 -> Sub1000 | "99"
|
||||
| pot2 | Numeral | Sub10 -> Sub1000 | "600"
|
||||
| pot2plus | Numeral | Sub10 -> Sub100 -> Sub1000 | "623"
|
||||
| pot2as3 | Numeral | Sub1000 -> Sub1000000 | "999"
|
||||
| pot3 | Numeral | Sub1000 -> Sub1000000 | "53000"
|
||||
| pot3plus | Numeral | Sub1000 -> Sub1000 -> Sub1000000 | "53201"
|
||||
|
||||
|
||||
@@ -80,7 +80,9 @@ redInfo (c,info) = errIn ("decompiling abstract" +++ show c) $ do
|
||||
xx' <- mapM redArgVar xx
|
||||
body' <- redCTerm body
|
||||
ppr' <- redCTerm ppr
|
||||
return $ G.CncFun Nothing (Yes (F.mkAbs xx' body')) (Yes ppr')
|
||||
cat' <- redIdent cat
|
||||
return $ G.CncFun (Just (cat', ([],F.typeStr))) -- Nothing
|
||||
(Yes (F.mkAbs xx' body')) (Yes ppr')
|
||||
|
||||
AnyInd b c -> liftM (G.AnyInd b) $ redIdent c
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ mkCncGroups opts0 ((res,path),files) = do
|
||||
return
|
||||
(\cat s ->
|
||||
errVal ([],"No parse") $
|
||||
optParseArgErrMsg (options [newMParser, firstCat cat, beVerbose]) gr s >>=
|
||||
optParseArgErrMsg (options [newFParser, firstCat cat, beVerbose]) gr s >>=
|
||||
(\ (ts,e) -> return (map tree2exp ts, e)) ,
|
||||
isKnownWord gr)
|
||||
putStrLn "Building parser"
|
||||
|
||||
@@ -204,7 +204,9 @@ renameTerm env vars = ren vars where
|
||||
| elem r vs -> return trm -- var proj first
|
||||
| otherwise -> case renid (Q r (label2ident l)) of -- qualif second
|
||||
Ok t -> return t
|
||||
_ -> liftM (flip P l) $ renid t -- const proj last
|
||||
_ -> case liftM (flip P l) $ renid t of
|
||||
Ok t -> return t -- const proj last
|
||||
_ -> prtBad "unknown qualified constant" trm
|
||||
|
||||
_ -> composOp (ren vs) trm
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ lookupResDef gr m c = look True m c where
|
||||
|
||||
CncCat (Yes ty) _ _ -> lock c ty
|
||||
CncCat _ _ _ -> lock c defLinType
|
||||
CncFun (Just (cat,_)) (Yes tr) _ -> unlock cat tr
|
||||
|
||||
CncFun _ (Yes tr) _ -> unlock c tr
|
||||
|
||||
AnyInd _ n -> look False n c
|
||||
@@ -73,7 +75,7 @@ lookupResType gr m c = do
|
||||
|
||||
-- used in reused concrete
|
||||
CncCat _ _ _ -> return typeType
|
||||
CncFun (Just (cat,(cont,val))) _ _ -> do
|
||||
CncFun (Just (cat,(cont@(_:_),val))) _ _ -> do
|
||||
val' <- lock cat val
|
||||
return $ mkProd (cont, val', [])
|
||||
CncFun _ _ _ -> lookFunType m m c
|
||||
|
||||
@@ -83,7 +83,8 @@ parseStringC opts0 sg cat s
|
||||
t:_ -> t
|
||||
_ -> [] ---- no support for undet. tok.
|
||||
ts <- checkErr $ New.parse algorithm strategy (pInfo sg) (absId sg) cat toks
|
||||
ts' <- mapM (checkErr . annotate (stateGrammarST sg) . refreshMetas []) ts
|
||||
ts' <- checkErr $
|
||||
allChecks $ map (annotate (stateGrammarST sg) . refreshMetas []) ts
|
||||
return $ optIntOrAll opts flagNumber ts'
|
||||
|
||||
|
||||
@@ -115,7 +116,8 @@ trees2trms opts sg cn as ts0 info = do
|
||||
)
|
||||
(ts1,ss) <- checkErr $ mapErrN 1 postParse ts01
|
||||
if null ts1 then raise ss else return ()
|
||||
ts2 <- mapM (checkErr . annotate gr . refreshMetas [] . trExp) ts1 ----
|
||||
ts2 <- checkErr $
|
||||
allChecks $ map (annotate gr . refreshMetas [] . trExp) ts1 ----
|
||||
if forgive then return ts2 else do
|
||||
let tsss = [(t, allLinsOfTree gr cn t) | t <- ts2]
|
||||
ps = [t | (t,ss) <- tsss,
|
||||
@@ -127,7 +129,6 @@ trees2trms opts sg cn as ts0 info = do
|
||||
unlines (nub (map sstr (concatMap snd tsss)))
|
||||
else ""
|
||||
else return ps
|
||||
|
||||
if verb
|
||||
then checkWarn $ " the token list" +++ show as ++++ unknownWords sg as +++++ info
|
||||
else return ()
|
||||
@@ -140,6 +141,8 @@ trees2trms opts sg cn as ts0 info = do
|
||||
verb = oElem beVerbose opts
|
||||
forgive = oElem forgiveParse opts
|
||||
|
||||
---- Operatins.allChecks :: ErrorMonad m => [m a] -> m [a]
|
||||
|
||||
unknownWords sg ts = case filter noMatch [t | t@(TS _) <- ts] of
|
||||
[] -> "where all words are known"
|
||||
us -> "with the unknown tokens" +++ show us --- needs to be fixed for literals
|
||||
|
||||
Reference in New Issue
Block a user